Device Policy Management
The Device Policy Management (DPM) framework supports enterprise applications by providing IT administrator functions to create security-aware applications. These applications are useful in scenarios where IT administrators require rich control over employee devices.
NoteSince Tizen 8.0, all Device Policy Manager APIs are deprecated and will be removed without any alternative.
The DPM framework consists of the following tools:
- Device policy client library: This contains all the device administration functions that a client application can call. The device policy client library communicates with the device policy manager using a built-in remote method invocation (RMI) engine.
- Device policy manager: This manages all the device policies. It also provides interfaces for the device policy client library.
The main features of the Tizen.Security.DevicePolicyManager namespace are as follows:
-
Managing policies
You can track the state between the device admin client and the device policy manager using the
DevicePolicyManager
class provided by Tizen.Security.DevicePolicyManager. -
Checking restrictions
You can check the restriction states of the device, such as camera, microphone, Wi-Fi, Bluetooth, and USB, using the properties of the policy classes. Tizen.Security.DevicePolicyManager provides these policy classes.
The following figure illustrates the DPM framework process:
Figure: DPM framework process
Prerequisites
To use the methods and properties of the Tizen.Security.DevicePolicyManager namespace, include it in your application:
C#
Copy
using Tizen.Security.DevicePolicyManager;
Manage device policies
To manage device policies, follow the steps below:
-
Create a
DevicePolicyManager
instance:C#CopyDevicePolicyManager dpm = new DevicePolicyManager();
-
Get the policy instance using
getPolicy<T>()
of the DevicePolicyManager instance:C#CopyMediaPolicy mediaPolicy = dpm.getPolicy<MediaPolicy>();
Note
The DevicePolicyManager instance must exist when you use the policy instance.
-
Register an event handler to manage the policies of the policy instance:
C#Copytry { DevicePolicyManager dpm = new DevicePolicyManager(); MediaPolicy mediaPolicy = dpm.getPolicy<MediaPolicy>(); /// Register the event handler mediaPolicy.CameraPolicyChanged += onCameraPolicyChanged; } catch (Exception e) { /// Handle exception } /// Create the event handler void onCameraPolicyChanged(Object Sender, PolicyChangedEventArgs args) { Console.WriteLine("PolicyName: " + args.PolicyName + ", Current policy state: " + args.IsAllowed); }
-
Check the device restriction state:
C#Copy/// Check the restriction state of the camera /// false: using the camera is not allowed /// true: using the camera is allowed bool cameraPolicyState = mediaPolicy.IsCameraAllowed;
-
When no longer needed, destroy the policy instance and DPM instance:
C#CopymediaPolicy.Dispose(); dpm.Dispose();
Note
The policy instance must be destroyed before the DPM instance.
Related information
- Dependencies
- Tizen 5.5 and Higher