PackageManager.CanRequestPackageInstalls Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Checks whether the calling package is allowed to request package installs through package installer.
[Android.Runtime.Register("canRequestPackageInstalls", "()Z", "GetCanRequestPackageInstallsHandler", ApiSince=26)]
public abstract bool CanRequestPackageInstalls ();
[<Android.Runtime.Register("canRequestPackageInstalls", "()Z", "GetCanRequestPackageInstallsHandler", ApiSince=26)>]
abstract member CanRequestPackageInstalls : unit -> bool
Returns
true if the calling package is trusted by the user to request install packages on the device, false otherwise.
- Attributes
Remarks
Checks whether the calling package is allowed to request package installs through package installer. Apps are encouraged to call this API before launching the package installer via intent android.content.Intent#ACTION_INSTALL_PACKAGE
. Starting from Android O, the user can explicitly choose what external sources they trust to install apps on the device. If this API returns false, the install request will be blocked by the package installer and a dialog will be shown to the user with an option to launch settings to change their preference. An application must target Android O or higher and declare permission android.Manifest.permission#REQUEST_INSTALL_PACKAGES
in order to use this API.
Java documentation for android.content.pm.PackageManager.canRequestPackageInstalls()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.