Mobile SDK Android: EPZPromoConfiguration

From ePrize Developers Wiki

(Difference between revisions)
Jump to: navigation, search
(Initial authoring)
(Adding correct content.)
Line 1: Line 1:
== Overview ==
== Overview ==
 +
The EPZPromoConfiguration class stores all necessary information specific to a promotion. You can use an instance of this class to gain access to all of the applicable pieces of information you’ll need for reference, display, and functionality.
-
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 [[Mobile_SDK_Android:_EPZPushPreferencesViewController|EPZPushPreferencesViewController]], where the preference items are listed with check boxes which the user can turn on/off as desired.
+
== Public Methods ==
-
<blockquote style="background:#ffd; border:1px solid #ddc; padding:20px;"><i><b>Note:</b> Unless you are creating a custom view controller to handle user preferences (and thus not using the SDK’s built-in [[Mobile_SDK_Android:_EPZPushPreferencesViewController|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 [[Mobile_SDK_Android:_EPZPushNotificationService#savePushNotificationPreferences|savePushNotificationPreferences()]] method is called to save a user’s preferences.</i></blockquote>
+
=== resetEndpointURL ===
-
 
+
-
 
+
-
== Public Constructors ==
+
-
 
+
-
=== EPZPreferenceItem ===
+
<pre>
<pre>
-
public EPZPreferenceItem(JSONObject data) throws Exception
+
public void resetEndpointURL()
</pre>
</pre>
-
Constructor method to create a new EPZPreferenceItem.
+
Method that resets the configuration's endpoint URL to the default value, removing any additional data that may have been added via the [[#appendEndpointURLWithData|appendEndpointURLWithData]] method.
-
<b>Parameters</b><br />
 
-
<i>data</i> A JSONObject with the following keys and value types:
 
-
:* <b>EPZConstants.DATA_KEY_ID</b> <i>(String)</i>
 
-
:* <b>EPZConstants.DATA_KEY_NAME</b> <i>(String)</i>
 
-
:* <b>EPZConstants.DATA_KEY_VALUE</b> <i>(Boolean)</i>
 
-
<b>Throws</b><br />
 
-
<i>Exception</i> if there is an error setting the required class values while parsing the <i>data</i> parameter.
 
- 
- 
-
== Public Methods ==
 
-
=== addPreferenceChild ===
+
=== appendEndpointURLWithData ===
<pre>
<pre>
-
public void addPreferenceChild(EPZPreferenceItem value)
+
public String appendEndpointURLWithData(Map<String, String> data)
</pre>
</pre>
-
Method to add a child preference item to this object.
+
Method that appends a configuration's endpoint URL with additional data (which is added via query parameters).
<b>Parameters</b><br />
<b>Parameters</b><br />
-
<i>value</i> EPZPreferenceItem to add as the child object.
+
<i>data</i> A map of String key/value pairs to be added to the endpoint URL.
 +
<div style="margin: 20px 0px; padding:20px; background:#ffd; border:1px solid #ddc;"><i><b>Please note:</b> This method will alter the stored value for the endpoint URL. As such, calling this method multiple times, especially with the same data set, is not advisable. If you must call this method, it is strongly recommended you include conditional logic in your app that detects the presence of a specific query parameter on the endpoint URL, and only call this method if no such value exists.</i></div>
-
=== getPreferenceId ===
+
=== getConfigKey ===
<pre>
<pre>
-
public String getPreferenceId()
+
public String getConfigKey()
</pre>
</pre>
<b>Returns</b><br />
<b>Returns</b><br />
-
<i>String</i> The preference item's unique id value.
+
<i>String</i> The configuration's key. This key is used to pass in to various methods, such as the [[Mobile_SDK_Android:_EPZPromoLibrary|EPZPromoLibrary]] [[Mobile_SDK_Android:_EPZPromoLibrary#launchPromotionForKey|launchPromotionForKey()]] method.
-
=== getPreferenceTitle ===
+
=== getConfigType ===
<pre>
<pre>
-
public String getPreferenceTitle()
+
public String getConfigType()
</pre>
</pre>
<b>Returns</b><br />
<b>Returns</b><br />
-
<i>String</i> The preference item's title.
+
<i>String</i> The promotion’s configuration type. As of version 1.0, the only value for this property is “mobileSdkV1”. This property serves little value outside of the core SDK logic.
-
=== getPreferenceValue ===
+
=== getDisplayURL ===
<pre>
<pre>
-
public Boolean getPreferenceValue()
+
public String getDisplayURL()
</pre>
</pre>
<b>Returns</b><br />
<b>Returns</b><br />
-
<i>Boolean</i> opt-in value for the preference item.
+
<i>String</i> The promotion’s URL, targeted for display. For instance, if a promotion uses a vanity URL, the vanity URL can be the value for this property. Similarly, if a promotion URL has query parameters attached to the URL that are not intended for display, this value may crop off the parameters, resulting in a URL that is more pleasing to the eye.
-
=== setPreferenceValue ===
+
=== getEndpointURL ===
<pre>
<pre>
-
public void setPreferenceValue(Boolean value)
+
public String getEndpointURL()
</pre>
</pre>
-
Method to set the preference item's opt-in value.
 
-
<b>Parameters</b><br />
+
<b>Returns</b><br />
-
<i>value</i> Boolean opt-in value.
+
<i>String</i> The promotion’s full URL. Unlike the display URL, this value may include additional URL information such as query parameters, or a URL that is masked by a vanity URL.
-
=== getPreferenceLevel ===
+
=== getPromoTitle ===
<pre>
<pre>
-
public int getPreferenceLevel()
+
public String getPromoTitle()
</pre>
</pre>
<b>Returns</b><br />
<b>Returns</b><br />
-
<i>int</i> The preference item's level.
+
<i>String</i> The promotion's title.
-
=== setPreferenceLevel ===
+
=== getAssetURLs ===
<pre>
<pre>
-
public void setPreferenceLevel(int value)
+
public Map<String, String> getAssetURLs()
</pre>
</pre>
-
Method to set the preference item's level.
 
-
<b>Parameters</b><br />
+
<b>Returns</b><br />
-
<i>value</i> int value of the preference level.
+
<i>Map<String, String></i> of the promotion’s asset URLs, as configured in the ePrize Configuration Service.
 +
<b>Important Note:</b> There are no set or default key values for this property, as all asset URLs are the responsibility of the party who configures the promotion in the ePrize Configuration Service. As such, if you choose to use asset URLs, it is recommended to do conditional checks for the existence of any map keys you attempt to use, to avoid null values and/or crashes.
-
=== getPreferenceParent ===
+
 
 +
=== getOpenInNativeBrowser ===
<pre>
<pre>
-
public String getPreferenceParent()
+
public Boolean getOpenInNativeBrowser()
</pre>
</pre>
<b>Returns</b><br />
<b>Returns</b><br />
-
<i>String</i> The preference item's parent (an EPZPreferenceItem's unique id), or null if no parent.
+
<i>Boolean</i> flag alerting whether the site is intended to launch in a device’s native browser. If true, the promotion will launch in the device's native browser rather than in the built-in EPZPromoWebViewController. This logic is handled automatically by the SDK in the [[#launchPromotionForKey|launchPromotionForKey()]] method.
-
=== setPreferenceParent ===
+
=== getEndDate ===
<pre>
<pre>
-
public void setPreferenceParent(String value)
+
public Date getEndDate()
</pre>
</pre>
-
Method to set the preference item's parent (an EPZPreferenceItem's unique id)
 
-
<b>Parameters</b><br />
+
<b>Returns</b><br />
-
<i>value</i> The unique id value of the parent preference item (String value).
+
<i>Date</i> The promotion’s end date. If you would like to know and/or display the end date for a promotion, you can use this property to get the value, and then use it as necessary.
-
=== getChildren ===
+
=== getLaunchDate ===
<pre>
<pre>
-
public ArrayList<EPZPreferenceItem> getChildren()
+
public Date getLaunchDate()
</pre>
</pre>
<b>Returns</b><br />
<b>Returns</b><br />
-
<i>ArrayList</i> of EPZPreferenceItem objects that are children (nested preferences) to this preference item.
+
<i>Date</i> The promotion’s launch date. If you would like to know and/or display the launch date for a promotion, you can use this property to get the value, and then use it as necessary.
-
 
+
-
 
+
-
 
+
-
 
+
-
=== setChildren ===
+
-
<pre>
+
-
public void setChildren(ArrayList<EPZPreferenceItem> value)
+
-
</pre>
+
-
Method to set the children (nested preferences) of the preference item.
+
-
 
+
-
<b>Parameters</b><br />
+
-
<i>value</i> ArrayList of EPZPreferenceItem objects to add as children.
+

Revision as of 23:06, 6 November 2014

Contents

Overview

The EPZPromoConfiguration class stores all necessary information specific to a promotion. You can use an instance of this class to gain access to all of the applicable pieces of information you’ll need for reference, display, and functionality.

Public Methods

resetEndpointURL

public void resetEndpointURL()

Method that resets the configuration's endpoint URL to the default value, removing any additional data that may have been added via the appendEndpointURLWithData method.



appendEndpointURLWithData

public String appendEndpointURLWithData(Map<String, String> data)

Method that appends a configuration's endpoint URL with additional data (which is added via query parameters).

Parameters
data A map of String key/value pairs to be added to the endpoint URL.

Please note: This method will alter the stored value for the endpoint URL. As such, calling this method multiple times, especially with the same data set, is not advisable. If you must call this method, it is strongly recommended you include conditional logic in your app that detects the presence of a specific query parameter on the endpoint URL, and only call this method if no such value exists.



getConfigKey

public String getConfigKey()

Returns
String The configuration's key. This key is used to pass in to various methods, such as the EPZPromoLibrary launchPromotionForKey() method.



getConfigType

public String getConfigType()

Returns
String The promotion’s configuration type. As of version 1.0, the only value for this property is “mobileSdkV1”. This property serves little value outside of the core SDK logic.



getDisplayURL

public String getDisplayURL()

Returns
String The promotion’s URL, targeted for display. For instance, if a promotion uses a vanity URL, the vanity URL can be the value for this property. Similarly, if a promotion URL has query parameters attached to the URL that are not intended for display, this value may crop off the parameters, resulting in a URL that is more pleasing to the eye.



getEndpointURL

public String getEndpointURL()

Returns
String The promotion’s full URL. Unlike the display URL, this value may include additional URL information such as query parameters, or a URL that is masked by a vanity URL.



getPromoTitle

public String getPromoTitle()

Returns
String The promotion's title.



getAssetURLs

public Map<String, String> getAssetURLs()

Returns
Map<String, String> of the promotion’s asset URLs, as configured in the ePrize Configuration Service.

Important Note: There are no set or default key values for this property, as all asset URLs are the responsibility of the party who configures the promotion in the ePrize Configuration Service. As such, if you choose to use asset URLs, it is recommended to do conditional checks for the existence of any map keys you attempt to use, to avoid null values and/or crashes.



getOpenInNativeBrowser

public Boolean getOpenInNativeBrowser()

Returns
Boolean flag alerting whether the site is intended to launch in a device’s native browser. If true, the promotion will launch in the device's native browser rather than in the built-in EPZPromoWebViewController. This logic is handled automatically by the SDK in the launchPromotionForKey() method.



getEndDate

public Date getEndDate()

Returns
Date The promotion’s end date. If you would like to know and/or display the end date for a promotion, you can use this property to get the value, and then use it as necessary.



getLaunchDate

public Date getLaunchDate()

Returns
Date The promotion’s launch date. If you would like to know and/or display the launch date for a promotion, you can use this property to get the value, and then use it as necessary.

Personal tools