Why can an Android app update do it twice?

I made many changes to my application: database schema, graphics, code, etc. The biggest package name I renamed to completely different. The application received the same name and identifier in the manifeste.xml file, and apk received the same name with the same digital signature.

However, when using ./adb install -r myapp.apkmyapp, it appears twice in the menu. Of course, since the database is stored in a directory with the package name as the name, the user feels that his data is lost.

How can I prevent this, and if I can’t, how can I automate its migration?

I have a few tips: asking the user to delete the old application, copying the database from the old file to the new one, etc.

+3
source share
2 answers

The direct answer is that the application appears twice, because the Android Market and Android OS consider two different packages as two different applications. The code may be the same, but if the packages are different, the applications are completely different

Android Market identifies applications by their package name. I suspect that this is due to the fact that the OS tracks programs by packages ... it makes sense that you do not want two packages with the same name to be installed, how would the OS know which one to call? Therefore, if you install a package with the same name as the package that is already installed, the OS will consider it as updating the package and give the new program access to the old user data.

, , , . . :

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

: , , . ( UserId ). ( ).

+3

. Eclipse, , 2 .

+1

Source: https://habr.com/ru/post/1708723/


All Articles