Click or drag to resize

ProfileManager Class

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

The ProfileManager type exposes the following members.

Constructors
  NameDescription
Public methodProfileManager
Initializes a new instance of the ProfileManager class
Top
Properties
  NameDescription
Public propertyJniPeerMembers
To be added.
Public propertyLoadedProfile
Returns the name of the manually loaded profile, otherwise an empty string.
Public propertyProfileRulesList
Gets the list of all the profile rules defined on the device.
Public propertyProfilesList
Gets the list of all the profiles saved on the device.
Top
Methods
  NameDescription
Public methodAddProfileRule
Creates a rule to automatically load the given profile when one of the specified activities comes to foreground.
Public methodCreateProfile(String, File, PersistenceType)
Creates the profile with the given name and the specified persistence type.
Public methodCreateProfile(String, IDictionaryInteger, String, String, PersistenceType)
Saves the given map as a profile with the specified name, description and persistence type.
Public methodDeleteProfile
Deletes the given profile.
Public methodLoadProfile
Applies the given profile.
Public methodRemoveProfileRule
Delete the specified rule.
Public methodUnloadProfile
Revert the manually loaded profile restoring the values previously set on the device.
Top
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:
  1. Factory Reset Persistent, the file containing the profile will survive to a factory reset. -
  2. Enterprise Reset Persistent, the file containing the profile will survive to an enterprise reset. -
  3. 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:
  1. manually, calling method LoadProfile(String), -
  2. 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:
  1. there is the constraint on the definition of a rule to forbid for an activity to be associated to more than one profile, and -
  2. 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:
  1. Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)]. -
  2. Create an HashMap and add it the couples {PropertyID,value} to be set applying the profile. -
  3. 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:
  1. Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)]. -
  2. Create a StringBuffer and initialize it with the preferred identifier to be used to register the rule. -
  3. 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:
  1. Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)]. -
  2. Load the profile calling LoadProfile(String). -
To get the identifier of the profile manually loaded, if any, do the following steps:
  1. Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)]. -
  2. Get the profile identifier calling LoadedProfile. -
To unload the profile manually loaded do the following steps:
  1. Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)]. -
  2. Unload the profile calling UnloadProfile. -
To delete the profile profilo_128.json do the following steps:
  1. Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)]. -
  2. Delete the profile calling DeleteProfile(String). -
To remove the rule "rule_1" do the following steps:
  1. Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)]. -
  2. Remove the rule calling RemoveProfileRule(String). -
To get the list of all the profiles saved on the device do the following steps:
  1. Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)]. -
  2. Get the list calling ProfilesList. -
To get the list of all the rules defined on the device do the following steps:
  1. Obtain an instance of ProfileManager with [!:Com.Datalogic.Device.Configuration.ProfileManager.ProfileManager(Context)]. -
  2. Get the list calling ProfileRulesList. -

[Android Documentation]

See Also