tags:

views:

257

answers:

1

I made a lot of changes to my app : databases scheme, graphics, code, etc. The biggest is the package name that I renamed to a total different one. The applicatgio got the same name and Id in the manifeste.xml file and the apk got the same name, with the same digital signature.

Nevertheless, when using ./adb install -r myapp.apk, myapp appears twice in the menu. Of course since the DB is stored in a directory using the package name as name, the user feel like its data is lost.

How can I prevent this from happening, and if I can't, how can I automate he migration ?

I have several clues : prompting the user for uninstalling the old app, copying the database from the old file to the new one, etc.

+1  A: 

The direct answer is the application appear twice because Android Market and Android OS view two different packages as two different applications. The code can be same, but if the packages are different the applications are completely different

Android Market identifies applications by their package name. I suspect this is because the OS tracks programs by package...makes sense that you wouldn't want two packages with the exact same name installed, how would the OS know which one to call? Therefore, if you install a package with the same name as a package that's already installed the OS will view it as a package upgrade and let the new program access the old user data.

You state that the packages share the same ID, I assume this is user ID. This enables you to share data between the packages. More information is here:

http://developer.android.com/guide/topics/security/security.html#userid

Recommendation: Release a small upgrade to your old package providing whatever glue is needed to let it share it's data with your new package. Then release your new package with the code to import the user data from the old package (need same UserId and signature). The transition would be seamless to the user (no manual backup and import).

Will
The only untidy part is now you have a program for the user to uninstall...I hope they uninstall the right one. Programmatic uninstall, my next SO question.
Will
Be interrested with this issue too.
e-satis