Android.Content.PM.PackageManager.AddPermission Method
Add a new dynamic permission to the system.

Syntax

[Android.Runtime.Register("addPermission", "(Landroid/content/pm/PermissionInfo;)Z", "GetAddPermission_Landroid_content_pm_PermissionInfo_Handler")]
public abstract bool AddPermission (PermissionInfo info)

See Also

PackageManager.RemovePermission(string)

Parameters

info
Description of the permission to be added.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Lang.SecurityExceptionif you are not allowed to add the given permission name.

Remarks

Add a new dynamic permission to the system. For this to work, your package must have defined a permission tree through the NoType:android/R$styleable;Href=../../../../reference/android/R.styleable.html#AndroidManifestPermissionTree tag in its manifest. A package can only add permissions to trees that were defined by either its own package or another with the same user id; a permission is in a tree if it matches the name of the permission tree + ".": for example, "com.foo.bar" is a member of the permission tree "com.foo".

It is good to make your permission tree name descriptive, because you are taking possession of that entire set of permission names. Thus, it must be under a domain you control, with a suffix that will not match any normal permissions that may be declared in any applications that are part of that domain.

New permissions must be added before any .apks are installed that use those permissions. Permissions you add through this method are remembered across reboots of the device. If the given permission already exists, the info you supply here will be used to update it.

[Android Documentation]

Requirements

Namespace: Android.Content.PM
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1