See Also: RestrictionsManager
public class RestrictionsManager : Object
Provides a mechanism for apps to query restrictions imposed by an entity that manages the user. Apps can also send permission requests to a local or remote device administrator to override default app-specific restrictions or any other operation that needs explicit authorization from the administrator.
Apps can expose a set of restrictions via an XML file specified in the manifest.
If the user has an active Restrictions Provider, dynamic requests can be made in addition to the statically imposed restrictions. Dynamic requests are app-specific and can be expressed via a predefined set of request types.
The RestrictionsManager forwards the dynamic requests to the active Restrictions Provider. The Restrictions Provider can respond back to requests by calling RestrictionsManager.NotifyPermissionResponse(String,PersistableBundle), when a response is received from the administrator of the device or user. The response is relayed back to the application via a protected broadcast, RestrictionsManager.ActionPermissionResponseReceived.
Static restrictions are specified by an XML file referenced by a meta-data attribute in the manifest. This enables applications as well as any web administration consoles to be able to read the list of available restrictions from the apk.
The syntax of the XML format is as follows:
The attributes for each restriction depend on the restriction type.
- key, title and restrictionType are mandatory.
- entries and entryValues are required if restrictionType is choice or multi-select.
- defaultValue is optional and its type depends on the restrictionType
- hidden type must have a defaultValue and will not be shown to the administrator. It can be used to pass along data that cannot be modified, such as a version code.
- description is meant to describe the restriction in more detail to the administrator controlling the values, if the title is not sufficient.
Only restrictions of type bundle and bundle_array can have one or multiple nested restriction elements.
In your manifest's application section, add the meta-data tag to point to the restrictions XML file as shown below:
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
The members of Android.Content.RestrictionsManager are listed below.
See Also: Object
|ActionPermissionResponseReceived||String. Broadcast intent delivered when a response is received for a permission request.|
|ActionRequestLocalApproval||String. Activity intent that is optionally implemented by the Restrictions Provider package to challenge for an administrator PIN or password locally on the device.|
|ActionRequestPermission||String. Broadcast intent sent to the Restrictions Provider to handle a permission request from an app.|
|ExtraPackageName||String. The package name of the application making the request.|
|ExtraRequestBundle||String. The request bundle passed in the RestrictionsManager.ActionRequestPermission broadcast.|
|ExtraRequestId||String. The request ID passed in the RestrictionsManager.ActionRequestPermission broadcast.|
|ExtraRequestType||String. The request type passed in the RestrictionsManager.ActionRequestPermission broadcast.|
|ExtraResponseBundle||String. Contains a response from the administrator for specific request.|
|MetaDataAppRestrictions||String. Name of the meta-data entry in the manifest that points to the XML file containing the application's available restrictions.|
|RequestKeyApproveLabel||String. Key for request approval button label contained in the request bundle.|
|RequestKeyData||String. Key for request data contained in the request bundle.|
|RequestKeyDenyLabel||String. Key for request rejection button label contained in the request bundle.|
|RequestKeyIcon||String. Key for request icon contained in the request bundle.|
|RequestKeyId||String. Key for request ID contained in the request bundle.|
|RequestKeyMessage||String. Key for request message contained in the request bundle.|
|RequestKeyNewRequest||String. Key for issuing a new request, contained in the request bundle.|
|RequestKeyTitle||String. Key for request title contained in the request bundle.|
|RequestTypeApproval||String. Request type for a simple question, with a possible title and icon.|
|ResponseKeyErrorCode||String. Key for the optional error code in the response bundle sent to the application.|
|ResponseKeyMessage||String. Key for the optional message in the response bundle sent to the application.|
|ResponseKeyResponseTimestamp||String. Key for the optional timestamp of when the administrator responded to the permission request.|
|ResponseKeyResult||String. Key for the response result in the response bundle sent to the application, for a permission request.|
Parse and return the list of restrictions defined in the manifest for the specified package, if any.
Called by the Restrictions Provider to deliver a response to an application.
|RequestPermission(String, String, PersistableBundle)|
Called by an application to request permission for an operation.