I have a feature to be implemented: install an apk programmatically. Code I'm using:
ComponentName comp = new ComponentName("com.android.packageinstaller", "com.android.packageinstaller.PackageInstallerActivity");
Intent newIntent = new Intent(callingIntent);
newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
newIntent.setComponent(comp);
The callingIntent contains an apk from another service.
On Android 6.0 (MPA44G, Nexus 5), this intent is crashing. Logcat:
08-20 14:58:56.127 26222 26222 E AndroidRuntime: Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.packageinstaller/com.android.packageinstaller.PackageInstallerActivity}; have you declared this activity in your AndroidManifest.xml?
On Lollipop- devices, the above code is working fine.
Has Google completely removed the PackageInstallerActivity? Is there any workaround to programmatically install an apk specifically on Android 6.0?