Context.EnforceCallingOrSelfPermission(String, String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
If neither you nor the calling process of an IPC you are
handling has been granted a particular permission, throw a
SecurityException
.
[Android.Runtime.Register("enforceCallingOrSelfPermission", "(Ljava/lang/String;Ljava/lang/String;)V", "GetEnforceCallingOrSelfPermission_Ljava_lang_String_Ljava_lang_String_Handler")]
public abstract void EnforceCallingOrSelfPermission (string permission, string? message);
[<Android.Runtime.Register("enforceCallingOrSelfPermission", "(Ljava/lang/String;Ljava/lang/String;)V", "GetEnforceCallingOrSelfPermission_Ljava_lang_String_Ljava_lang_String_Handler")>]
abstract member EnforceCallingOrSelfPermission : string * string -> unit
Parameters
- permission
- String
The name of the permission being checked.
- message
- String
A message to include in the exception if it is thrown.
- Attributes
Remarks
If neither you nor the calling process of an IPC you are handling has been granted a particular permission, throw a SecurityException
. This is the same as #enforceCallingPermission
, except it grants your own permissions if you are not currently processing an IPC. Use with care!
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.