Mobile SDK Android: EPZPromoConfiguration
From ePrize Developers Wiki
(Initial authoring) |
m (Minor formatting updates) |
||
(One intermediate revision not shown.) | |||
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. | ||
- | + | == Public Methods == | |
- | + | === resetEndpointURL === | |
- | + | ||
- | + | ||
- | == | + | |
- | + | ||
- | + | ||
<pre> | <pre> | ||
- | public | + | public void resetEndpointURL() |
</pre> | </pre> | ||
- | + | 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> | ||
+ | <hr/> | ||
- | + | === appendEndpointURLWithData === | |
- | + | ||
- | + | ||
- | + | ||
- | == | + | |
- | + | ||
- | + | ||
<pre> | <pre> | ||
- | public | + | public String appendEndpointURLWithData(Map<String, String> data) |
</pre> | </pre> | ||
- | Method | + | 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> | + | <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> | ||
+ | <hr/> | ||
- | + | === getConfigKey === | |
- | === | + | |
<pre> | <pre> | ||
- | public String | + | public String getConfigKey() |
</pre> | </pre> | ||
<b>Returns</b><br /> | <b>Returns</b><br /> | ||
- | <i>String</i> The | + | <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. |
+ | <hr/> | ||
- | + | === getConfigType === | |
- | === | + | |
<pre> | <pre> | ||
- | public String | + | public String getConfigType() |
</pre> | </pre> | ||
<b>Returns</b><br /> | <b>Returns</b><br /> | ||
- | <i>String</i> The | + | <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. |
- | + | ||
+ | <hr/> | ||
- | === | + | === getDisplayURL === |
<pre> | <pre> | ||
- | public | + | public String getDisplayURL() |
</pre> | </pre> | ||
<b>Returns</b><br /> | <b>Returns</b><br /> | ||
- | <i> | + | <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. |
+ | <hr/> | ||
- | + | === getEndpointURL === | |
- | === | + | |
<pre> | <pre> | ||
- | public | + | public String getEndpointURL() |
</pre> | </pre> | ||
- | Method to set the preference item's opt-in value. | ||
- | |||
- | <b>Parameters</b><br /> | ||
- | <i>value</i> Boolean opt-in value. | ||
+ | <b>Returns</b><br /> | ||
+ | <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. | ||
+ | <hr/> | ||
- | === | + | === getPromoTitle === |
<pre> | <pre> | ||
- | public | + | public String getPromoTitle() |
</pre> | </pre> | ||
<b>Returns</b><br /> | <b>Returns</b><br /> | ||
- | <i> | + | <i>String</i> The promotion's title. |
+ | <hr/> | ||
- | + | === getAssetURLs === | |
- | === | + | |
<pre> | <pre> | ||
- | public | + | public Map<String, String> getAssetURLs() |
</pre> | </pre> | ||
- | Method to set the preference item's level. | ||
- | <b> | + | <b>Returns</b><br /> |
- | <i> | + | <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. | ||
+ | <hr/> | ||
- | === | + | === getOpenInNativeBrowser === |
<pre> | <pre> | ||
- | public | + | public Boolean getOpenInNativeBrowser() |
</pre> | </pre> | ||
<b>Returns</b><br /> | <b>Returns</b><br /> | ||
- | <i> | + | <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. |
+ | <hr/> | ||
- | + | === getEndDate === | |
- | === | + | |
<pre> | <pre> | ||
- | public | + | public Date getEndDate() |
</pre> | </pre> | ||
- | Method to set the preference item's parent (an EPZPreferenceItem's unique id) | ||
- | <b> | + | <b>Returns</b><br /> |
- | <i> | + | <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. |
+ | <hr/> | ||
- | + | === getLaunchDate === | |
- | === | + | |
<pre> | <pre> | ||
- | public | + | public Date getLaunchDate() |
</pre> | </pre> | ||
<b>Returns</b><br /> | <b>Returns</b><br /> | ||
- | <i> | + | <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. |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + |
Current revision
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.
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.