Android.Test.Mock.MockPackageManager.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 override bool AddPermission (Android.Content.PM.PermissionInfo info)

Parameters

info
Description of the permission to be added.

Returns

Documentation for this section has not yet been entered.

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.Test.Mock
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1