Reputation: 7856
I am building a launcher application that I would like to update over the air. I created a service class that successfully checks and compares App version numbers to determine whether an update is needed. If the compared apk version is higher than current version, I download the apk from my cloud server, and then bring up a dialog to install it.
The conflict I am facing is that the update will not install. I receive an error "An existing package by the same name with a conflicting signature is already installed". I am beginning to wonder if my methodology is correct. How can I resolve this? Here is what I am doing.
Once an update is confirmed, I display a dialog and on press of the confirmation button I use an Intent to parse the app URL
Intent i = new Intent(Intent.ACTION_VIEW);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setData(Uri.parse(appUrl));
startActivity(i);
finish();
This actually posts a notification that I have to click and press install on. Once I do, it attempts to install, but then gives me the error on conflicting signatures.
Ideally, I just want it to install without having to see the notification. Thank you in advance.
Upvotes: 2
Views: 1176
Reputation: 363
You need not necessarily use Playstore or any other app hosting service to manage your application upgrades. Your users should enable: Install from un-identified sources (on their android handset)
For auto-upgrade you must release all your APK's with the same Signature. If you just build and run the application from Eclipse, the APK file generated in DIST folder is signed with Debug key (the default key of each machine)
Now if you build the same Code from different machine, the debug key values will be different and you would get the error: "An existing package by the same name with a conflicting signature is already installed" while installing the new APK
Here are a few solutions to it:
Upvotes: 2
Reputation: 48
I have seen the "same signature" error when deploying directly from Android Debug Bridge. I am thinking you will not be successful in this approach, because:
Here are the allowable ways to perform an upgrade: Is there a way to automatically update application on Android?
Upvotes: 1
Reputation: 13616
You are setting it up almost correctly, but you should also set the data type:
i.setType("application/vnd.android.package-archive")
Additionally, do not call finish()
after startActivity()
. It is not necessary and might cause issues with the new Intent.
Your signature conflict is another problem. See this answer. The APK you are trying to install is signed with a different key that the currently installed one.
Finally, there is no way to install an APK without the user's explicit interaction (unless you have root, of course). This is intention for security reasons.
Upvotes: 1