Mobile SDK Android: EPZPreferenceItem
From ePrize Developers Wiki
(Initial authoring) |
m (Minor formatting updates) |
||
Line 37: | Line 37: | ||
- | + | <hr/> | |
=== getPreferenceId === | === getPreferenceId === | ||
Line 48: | Line 48: | ||
- | + | <hr/> | |
=== getPreferenceTitle === | === getPreferenceTitle === | ||
Line 59: | Line 59: | ||
- | + | <hr/> | |
=== getPreferenceValue === | === getPreferenceValue === | ||
Line 70: | Line 70: | ||
- | + | <hr/> | |
=== setPreferenceValue === | === setPreferenceValue === | ||
Line 82: | Line 82: | ||
- | + | <hr/> | |
=== getPreferenceLevel === | === getPreferenceLevel === | ||
Line 93: | Line 93: | ||
- | + | <hr/> | |
=== setPreferenceLevel === | === setPreferenceLevel === | ||
Line 105: | Line 105: | ||
- | + | <hr/> | |
=== getPreferenceParent === | === getPreferenceParent === | ||
Line 116: | Line 116: | ||
- | + | <hr/> | |
=== setPreferenceParent === | === setPreferenceParent === | ||
Line 128: | Line 128: | ||
- | + | <hr/> | |
=== getChildren === | === getChildren === | ||
Line 139: | Line 139: | ||
- | + | <hr/> | |
=== setChildren === | === setChildren === |
Current revision
Contents |
Overview
The EPZPreferenceItem class stores all necessary information specific to a push notification preference object. EPZPreferenceItem objects are data classes that are used in the SDK’s built-in EPZPushPreferencesViewController, where the preference items are listed with check boxes which the user can turn on/off as desired.
Note: Unless you are creating a custom view controller to handle user preferences (and thus not using the SDK’s built-in EPZPushPreferencesViewController), you will not need to create instances of this class, or otherwise reference instances of this class. By default, the SDK takes care of keeping track of getting/setting values, and syncing the values for saving when the savePushNotificationPreferences() method is called to save a user’s preferences.
Public Constructors
EPZPreferenceItem
public EPZPreferenceItem(JSONObject data) throws Exception
Constructor method to create a new EPZPreferenceItem.
Parameters
data A JSONObject with the following keys and value types:
- EPZConstants.DATA_KEY_ID (String)
- EPZConstants.DATA_KEY_NAME (String)
- EPZConstants.DATA_KEY_VALUE (Boolean)
Throws
Exception if there is an error setting the required class values while parsing the data parameter.
Public Methods
addPreferenceChild
public void addPreferenceChild(EPZPreferenceItem value)
Method to add a child preference item to this object.
Parameters
value EPZPreferenceItem to add as the child object.
getPreferenceId
public String getPreferenceId()
Returns
String The preference item's unique id value.
getPreferenceTitle
public String getPreferenceTitle()
Returns
String The preference item's title.
getPreferenceValue
public Boolean getPreferenceValue()
Returns
Boolean opt-in value for the preference item.
setPreferenceValue
public void setPreferenceValue(Boolean value)
Method to set the preference item's opt-in value.
Parameters
value Boolean opt-in value.
getPreferenceLevel
public int getPreferenceLevel()
Returns
int The preference item's level.
setPreferenceLevel
public void setPreferenceLevel(int value)
Method to set the preference item's level.
Parameters
value int value of the preference level.
getPreferenceParent
public String getPreferenceParent()
Returns
String The preference item's parent (an EPZPreferenceItem's unique id), or null if no parent.
setPreferenceParent
public void setPreferenceParent(String value)
Method to set the preference item's parent (an EPZPreferenceItem's unique id)
Parameters
value The unique id value of the parent preference item (String value).
getChildren
public ArrayList<EPZPreferenceItem> getChildren()
Returns
ArrayList of EPZPreferenceItem objects that are children (nested preferences) to this preference item.
setChildren
public void setChildren(ArrayList<EPZPreferenceItem> value)
Method to set the children (nested preferences) of the preference item.
Parameters
value ArrayList of EPZPreferenceItem objects to add as children.