Inheritance Hierarchy Object
Com.Datalogic.Device.ConfigurationProfileManager
Namespace:
Com.Datalogic.Device.Configuration
Assembly:
datalogic-xamarin-sdk (in datalogic-xamarin-sdk.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public class ProfileManager : Object
Public Class ProfileManager
Inherits Object
The ProfileManager type exposes the following members.
Constructors
| Name | Description |
---|
| ProfileManager | Initializes a new instance of the ProfileManager class |
TopProperties Methods Remarks ProfileManager gives the developer the ability to create a profile and to load it explicitly or to associate it to a loading condition to be automatically loaded.
A profile is a set of
Propertys with their value.
The utility of a profile is that we can collect in it the setting of the properties we need for a
specific purpose and then we can load it explicitly calling
LoadProfile(String) or automatically when
an activity comes to foreground, defining a rule (
[!:Com.Datalogic.Device.Configuration.ProfileManager.addProfileRule(java.lang.StringBuffer,%20java.lang.String,%20java.lang.String,%20java.util.ArrayList)]) that associates that profile with the activity.
A profile is identified by a symbolic name that must be unique on the device.
When a profile is created it is assigned a
PersistenceType that can be:
- Factory Reset Persistent, the file containing the profile will survive to a factory reset.
-
- Enterprise Reset Persistent, the file containing the profile will survive to an enterprise reset.
-
- Reboot Persistent, the file containing the profile will survive to a reboot.
-
A Factory Reset Persistent profile can only be preinstalled on the device by an Espresso OTA and cannot be deleted.
The creation of a profile is done in best effort with reference to the specified set of couples of property and value,
that is when a profile is created all the properties that are read-only or which are set to values outside the range of their allowed
values or which require a device reboot to be applied are ignored.
A profile is saved on the device in a json file with the following schema:
As said a profile can be load in two different mode:
- manually, calling method LoadProfile(String),
-
- automatically, calling the method [!:Com.Datalogic.Device.Configuration.ProfileManager.addProfileRule(java.lang.StringBuffer,%20java.lang.String,%20java.lang.String,%20java.util.ArrayList)] to define a rule that associates the profile to a set of activities.
When one of the specified activities comes to the foreground
the profile will be automatically loaded. The previous configuration will be restored when the activity will be no more in foreground.
An activity can have only one profile associated.
-
Given their nature there can be only one profile automatically loaded at the time, because:
- there is the constraint on the definition of a rule to forbid for an activity to be associated to more than one profile, and
-
- there is only one activity in top foreground at a time.
-
The method
LoadProfile(String) fails if there is already a profile manually loaded.
It is allowed to have at the same moment a manually loaded profile and an automatically loaded profile.
When there is both a manually loaded profile and an automatically loaded profile the value of the properties belonging to both profiles
are set to the value specified in the automatically loaded profile. This is true no matter the order of load of the two profiles was.
The persistence type of a profile controls the persistence to reboot or reset of the file saved on the device not the persistence of the applied profile configuration.
The configuration applied by an automatically loaded profile is automatically unloaded when the associated activity is no more in foreground or the device restarts.
The configuration applied by a manually loaded profile is persistent to a reboot and must be explicitly unloaded.
To create a profile do the following steps:- Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)].
-
- Create an HashMap and add it the couples {PropertyID,value} to be set applying the profile.
-
- Create the profile calling [!:Com.Datalogic.Device.Configuration.ProfileManager.createProfile(java.lang.String,%20java.util.HashMap,%20java.lang.String,%20com.datalogic.device.PersistenceType)].
-
To add a rule to automatically load the profile profilo_128.json when the app with package com.datalogic.testprofilo1
comes to the foreground do the following steps:- Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)].
-
- Create a StringBuffer and initialize it with the preferred identifier to be used to register the rule.
-
- Create the rule calling [!:Com.Datalogic.Device.Configuration.ProfileManager.addProfileRule(java.lang.StringBuffer,%20java.lang.String,%20java.lang.String,%20java.util.ArrayList)].
-
To manually load the profile profilo_128.json do the following steps:- Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)].
-
- Load the profile calling LoadProfile(String).
-
To get the identifier of the profile manually loaded, if any, do the following steps:- Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)].
-
- Get the profile identifier calling LoadedProfile.
-
To unload the profile manually loaded do the following steps:- Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)].
-
- Unload the profile calling UnloadProfile.
-
To delete the profile profilo_128.json do the following steps:- Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)].
-
- Delete the profile calling DeleteProfile(String).
-
To remove the rule "rule_1" do the following steps:- Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)].
-
- Remove the rule calling RemoveProfileRule(String).
-
To get the list of all the profiles saved on the device do the following steps:- Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)].
-
- Get the list calling ProfilesList.
-
To get the list of all the rules defined on the device do the following steps:- Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)].
-
- Get the list calling ProfileRulesList.
-
[Android Documentation]
See Also