My application checks if there is a new version of my application (my application is not included in the play store) and automatically downloads the apk file to sdcard / download. Then I would like to start the installation, and I use this code:
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "file.apk")), "application/vnd.android.package-archive"); startActivity(intent);
but it shows the popup window "Error parsing: problem with package parse"
In my AndroidManifest, I gave permission:
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.INSTALL_PACKAGES"/> <uses-permission android:name="android.permission.DELETE_PACKAGES"/>
source share