Reputation: 7810
I am trying to implement AUTOUPDATE functionality in my android app, as it is a custom app not published via android market. So far I have everything working, however android tries to install the App and says "APPLICATION NOT INSTALLED". I don't know if it is important, but the App is already on the device, so it is an update.
The app downloads the APK file from the internet and stores it on the SDcard. Than I do this:
Uri packageURI = Uri.parse("package:my_package");
Intent intent = new Intent(Intent.ACTION_VIEW, packageURI);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + ApkName)),
"application/vnd.android.package-archive");
startActivity(intent);
Upvotes: 1
Views: 1509
Reputation: 46856
Here is a snippet I use, it looks basically the same as yours the only difference I can see is the use of packageURI. I don't know if using the packageURI would cause it not to work, but if I were you I'd try without.
File appFile = new File(ScreenSaverActivity.this.getFilesDir() + File.separator + APPLICATION_FILE_NAME);
Intent installIntent = new Intent(Intent.ACTION_VIEW);
installIntent.setDataAndType(Uri.fromFile(appFile),"application/vnd.android.package-archive");
startActivity(installIntent);
However generally when you see the "Application Not Installed" message while attempting to install it means that the signature used to sign the 2 apk's was different i.e. one is release key signed, one is debug key signed. Or perhaps if the 2 apks were compiled on different computers you've got them signed with 2 different debug keys.
Note that even though you are not distributing via the market you still need to generate and sign your application. Debug key's expire after 1 year which your app will stop working once the key has expired.
Upvotes: 3
Reputation: 3748
1) Check whether the Application name specified in the manifest file is same as before.
2) I guess you may have to get some more package information to match. Especially if the application is built from different machine, the signature might differ (I am not 100% sure about this). Also if you are using Eclipse. Check under Run Configuration, check the package name specified whether it is the same as the one used for initial release.
Upvotes: 0