How can I include information to my android application post compilation?
Currently I supply a user with a URL to click on to download my j2me application. This URL includes their user id as a parameter, a servlet takes this information and dynamically creates a jad file that includes this user id , thus making the user id available to the j2me app.
However, I am now using j2me polish t开发者_JS百科o compile my program and thus have the compiled .apk for this same program. However, I cannot work out how to make this information accessible to the the compiled program as there is no jad / jar mechanism. The information is only available at the time of download.
Any suggestions gratefully received! (is this even possible in an android application?)
Thanks,
CJ
p.s. I have to assume complete illiteracy from the users point of view, i.e. I cannot ask them to first install other programs etc, it needs to be a simple "click on the link" -> "get the app" sort of thing.
The .apk
format is based on the .jar
format so is just a ZIP file meaning you can open it with anything that processes ZIP files.
Files which are in the assets
folder of your application aren't altered by the .apk
build process so it should be possible to store the URL in a text file in assets
and then read it using AssetManager.open()
. Your server would have to open the .apk
and update the text file in assets
before offering it for download.
However, a complication is that all Android applications must be signed or they will not install. This is true even if you're not distributing your application via the Market. So as well as updating the .apk
file your server would have to re-sign it using something like keytool
.
精彩评论