Skip to content

Most visited

Recently visited

navigation

RestrictionsReceiver

public abstract class RestrictionsReceiver
extends BroadcastReceiver

java.lang.Object
   ↳ android.content.BroadcastReceiver
     ↳ android.service.restrictions.RestrictionsReceiver


Abstract implementation of a Restrictions Provider BroadcastReceiver. To implement a Restrictions Provider, extend from this class and implement the abstract methods. Export this receiver in the manifest. A profile owner device admin can then register this component as a Restrictions Provider using setRestrictionsProvider(ComponentName, ComponentName).

The function of a Restrictions Provider is to transport permission requests from apps on this device to an administrator (most likely on a remote device or computer) and deliver back responses. The response should be sent back to the app via notifyPermissionResponse(String, PersistableBundle).

See also:

Summary

Public constructors

RestrictionsReceiver()

Public methods

void onReceive(Context context, Intent intent)

Intercept standard Restrictions Provider broadcasts.

abstract void onRequestPermission(Context context, String packageName, String requestType, String requestId, PersistableBundle request)

An asynchronous permission request made by an application for an operation that requires authorization by a local or remote administrator other than the user.

Inherited methods

From class android.content.BroadcastReceiver
From class java.lang.Object

Public constructors

RestrictionsReceiver

added in API level 21
RestrictionsReceiver ()

Public methods

onReceive

added in API level 21
void onReceive (Context context, 
                Intent intent)

Intercept standard Restrictions Provider broadcasts. Implementations should not override this method; it is better to implement the convenience callbacks for each action.

Parameters
context Context: The Context in which the receiver is running.
intent Intent: The Intent being received.

onRequestPermission

added in API level 21
void onRequestPermission (Context context, 
                String packageName, 
                String requestType, 
                String requestId, 
                PersistableBundle request)

An asynchronous permission request made by an application for an operation that requires authorization by a local or remote administrator other than the user. The Restrictions Provider should transfer the request to the administrator and deliver back a response, when available. The calling application is aware that the response could take an indefinite amount of time.

If the request bundle contains the key REQUEST_KEY_NEW_REQUEST, then a new request must be sent. Otherwise the provider can look up any previous response to the same requestId and return the cached response.

Parameters
context Context
packageName String: the application requesting permission.
requestType String: the type of request, which determines the content and presentation of the request data.
requestId String
request PersistableBundle: the request data bundle containing at a minimum a request id.

See also:

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.