When my server gaves apk file to user, I need to put some values In this file, for开发者_开发百科 j2me platform I use JAD file, and put my values there:
MY_KEY: SomeKeyValue
MY_KEY2: SomeKeyValue2
When j2me application starts on device, I can access this values through System.getProperty.
How can I do the same on android platform?
How can I do the same on android platform?
You cannot "do the same on android platform" for applications distributed through the Android Market. An APK file is digitally signed and cannot be modified once signed and uploaded to the Market.
You mention "When my server gaves apk file to user", suggesting you are not using the Market. In that case, when the user requests the APK:
- Create a copy of your project directory (with compiled classes)
- Modify an XML resource (
res/xml/
) with the data you want for the user - Use Ant to package and sign the APK file using the SDK tools
- Serve the result
I do not know of anyone doing this, so I cannot point you to any code that implements the technique.
精彩评论