Java – Android installs the apk without asking for the user’s permission

Android installs the apk without asking for the user’s permission… here is a solution to the problem.

Android installs the apk without asking for the user’s permission

I’m building an app for kiosk mode. The device is not rooted.
The application is a device administrator (android.permission.BIND_DEVICE_ADMIN). I want the app to be able to download other apks and install them directly on tablet without asking permission.

Currently I am using Android DownloadManager to download the apk:
And then:

Intent intent = new Intent(Intent.ACTION_VIEW);
                                intent.setDataAndType(Uri.fromFile(new File(filePath)), "application/vnd.android.package-archive");
                                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  without this flag android returned a intent error!
                                DownloadManagerActivity.this.startActivity(intent);

Install the apk. But this will bring up a confirmation window.
Is there a way to install the apk directly after downloading?
Thanks

Update:

I saw this article:
https://paulononaka.wordpress.com/2011/07/02/how-to-install-a-application-in-background-on-android/

But it doesn’t work, and it’s very limited.

Solution

If there is no pop-up confirmation, the APK cannot be installed. This is a security feature by design. Some phone vendors, such as Samsung, offer options such as SAFE or KNOX that allow installation without prompting, but it requires additional permissions, and these technologies are not available on all Android devices.

Related Problems and Solutions