Android.Test.Mock.MockContext.EnforceCallingPermission Method
If the calling process of an IPC you are handling has not been granted a particular permission, throw a Java.Lang.SecurityException.

Syntax

[Android.Runtime.Register("enforceCallingPermission", "(Ljava/lang/String;Ljava/lang/String;)V", "GetEnforceCallingPermission_Ljava_lang_String_Ljava_lang_String_Handler")]
public override void EnforceCallingPermission (string permission, string message)

Parameters

permission
The name of the permission being checked.
message
A message to include in the exception if it is thrown.

Remarks

If the calling process of an IPC you are handling has not been granted a particular permission, throw a Java.Lang.SecurityException. This is basically the same as calling Android.Content.Context.EnforcePermission(string, System.Int32, System.Int32, System.Int32) with the pid and uid returned by Android.OS.Binder.CallingPid and Android.OS.Binder.CallingUid. One important difference is that if you are not currently processing an IPC, this function will always throw the SecurityException. This is done to protect against accidentally leaking permissions; you can use Android.Content.Context.EnforceCallingOrSelfPermission(string, System.String) to avoid this protection.

[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