Reputation: 6043
I have been trying to install other apps from my app. I have downloaded the .apk from the server and I am firing an intent with the following content
Intent installIntent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
installIntent.setData(Uri.parse("file:<apk file location>"));
installIntent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, DOWNLOADED_PACKAGE_NAME);
installIntent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
installIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
startActivityForResult(installIntent, REQUEST_INSTALL);
How to avoid this prompt?
This feature has been added since 4.2 ONLY.
Upvotes: 4
Views: 20250
Reputation: 41
Problem Solved.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.android.packageinstaller", "com.android.packageinstaller.PackageInstallerActivity");
Upvotes: 4