Class PrivacyPrivilegeManager

Definition

Namespace:
Tizen.Security
Assembly:
Tizen.Security.PrivacyPrivilegeManager.dll
API Level:
4

The PrivacyPrivilegeManager provides the properties or methods to check and request a permission for privacy privilege.

C#
Copy
public static class PrivacyPrivilegeManager
Inheritance
PrivacyPrivilegeManager

Methods

View Source

CheckPermission(String)

Gets the status of a privacy privilege permission.

Declaration
C#
Copy
public static CheckResult CheckPermission(string privilege)
Parameters
Type Name Description
System.String privilege

The privacy privilege to be checked.

Returns
Type Description
CheckResult

The permission setting for a respective privilege.

Examples
Copy
CheckResult result = PrivacyPrivilegeManager.CheckPermission("http://tizen.org/privilege/account.read"); switch (result) { case Allow: // Privilege can be used break; case Deny: // Privilege can't be used break; case Ask: // User permission request required PrivacyPrivilegeManager.RequestPermission("http://tizen.org/privilege/account.read"); break; }
Exceptions
Type Condition
System.ArgumentException

Thrown when an invalid parameter is passed.

OutOfMemoryException

Thrown when a memory error occurred.

IOException

Thrown when the method failed due to an internal I/O error.

API Level: 4
View Source

GetResponseContext(String)

Gets the response context for a given privilege.

Declaration
C#
Copy
public static WeakReference<PrivacyPrivilegeManager.ResponseContext> GetResponseContext(string privilege)
Parameters
Type Name Description
System.String privilege

The privilege.

Returns
Type Description
WeakReference<PrivacyPrivilegeManager.ResponseContext>

The response context of a respective privilege.

Examples
Copy
private static void PPM_RequestResponse(object sender, RequestResponseEventArgs e) { if (e.cause == CallCause.Answer) { switch(e.result) { case RequestResult.AllowForever: Console.WriteLine("User allowed usage of privilege {0} definitely", e.privilege); break; case RequestResult.DenyForever: Console.WriteLine("User denied usage of privilege {0} definitely", e.privilege); break; case RequestResult.DenyOnce: Console.WriteLine("User denied usage of privilege {0} this time", e.privilege); break; }; } else { Console.WriteLine("Error occured during requesting permission for {0}", e.privilege); } } PrivacyPrivilegeManager.ResponseContext context = null; PrivacyPrivilegeManager.GetResponseContext("http://tizen.org/privilege/account.read").TryGetTarget(out context); if(context != null) { context.ResponseFetched += PPM_RequestResponse; } PrivacyPrivilegeManager.RequestPermission("http://tizen.org/privilege/account.read"); PrivacyPrivilegeManager.GetResponseContext("http://tizen.org/privilege/account.read").TryGetTarget(out context); if(context != null) { context.ResponseFetched -= PPM_RequestResponse; }
Exceptions
Type Condition
System.ArgumentException

Thrown if the key is an invalid parameter.

API Level: 4
View Source

RequestPermission(String)

Triggers the permission request for a user.

Declaration
C#
Copy
public static void RequestPermission(string privilege)
Parameters
Type Name Description
System.String privilege

The privacy privilege to be requested.

Examples
Copy
CheckResult result = PrivacyPrivilegeManager.CheckPermission("http://tizen.org/privilege/account.read"); switch (result) { case Allow: // Privilege can be used break; case Deny: // Privilege can't be used break; case Ask: // User permission request required PrivacyPrivilegeManager.RequestPermission("http://tizen.org/privilege/account.read"); break; }
Exceptions
Type Condition
System.ArgumentException

Thrown when an invalid parameter is passed.

OutOfMemoryException

Thrown when a memory error occurred.

IOException

Thrown when the method failed due to an internal I/O error.

API Level: 4