Plz check below classe & give me the suggestion for how to use them https://developer.android.com/reference/android/content/pm/PackageInstaller.html https://developer.an
You cannot silently install a third party application in the newly created user with PackageInstaller.Session.commit() without specific "rights".
You either need :
ROOT_UID
. Which means you'll have to root the device. From the Android source code:
if ((mPm.checkUidPermission(android.Manifest.permission.INSTALL_PACKAGES, installerUid) == PackageManager.PERMISSION_GRANTED)
|| (installerUid == Process.ROOT_UID)) {
mPermissionsAccepted = true;
} else {
mPermissionsAccepted = false;
}
If you neither have root access and the INSTALL_PACKAGES
permission, then a message will be prompted to the user to ask if he confirms the permissions. This confirmation is then used during the commit process
of the PackageInstaller's
session. Obviously, in this case, this is not transparent, since the user will have to manually confirm the installation of your apps.