Skip to content

canRequestInstalls

Saasmull edited this page May 6, 2021 · 1 revision

canRequestPackageInstalls

Added in API level 26

public abstract boolean canRequestPackageInstalls ()

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 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 Manifest.permission.REQUEST_INSTALL_PACKAGES in order to use this API.

Returns
boolean true if the calling package is trusted by the user to request install packages on the device, false otherwise.

See also:

  • Intent.ACTION_INSTALL_PACKAGE
  • Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES

Clone this wiki locally