Search Results for

    Show / Hide Table of Contents

    Class PrivacyPrivilegeManager

    Definition

    Namespace:
    Tizen.Security
    Assembly:
    Tizen.Security.PrivacyPrivilegeManager.dll

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

    public static class PrivacyPrivilegeManager
    Inheritance
    object
    PrivacyPrivilegeManager

    Methods

    View Source

    CheckPermission(string)

    Gets the status of a privacy privilege permission.

    Declaration
    public static CheckResult CheckPermission(string privilege)
    Parameters
    Type Name Description
    string privilege

    The privacy privilege to be checked.

    Returns
    Type Description
    CheckResult

    The permission setting for a respective privilege.

    Examples
    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
    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.

    View Source

    GetResponseContext(string)

    Gets the response context for a given privilege.

    Declaration
    public static WeakReference<PrivacyPrivilegeManager.ResponseContext> GetResponseContext(string privilege)
    Parameters
    Type Name Description
    string privilege

    The privilege.

    Returns
    Type Description
    WeakReference<PrivacyPrivilegeManager.ResponseContext>

    The response context of a respective privilege.

    Examples
     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
    ArgumentException

    Thrown if the key is an invalid parameter.

    See Also
    PrivacyPrivilegeManager.ResponseContext
    View Source

    RequestPermission(string)

    Triggers the permission request for a user.

    Declaration
    public static void RequestPermission(string privilege)
    Parameters
    Type Name Description
    string privilege

    The privacy privilege to be requested.

    Examples
    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
    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.

    • View Source
    Back to top Copyright © 2016-2025 Samsung
    Generated by DocFX