|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sponsorpay.sdk.android.publisher.OfferBannerRequest
public class OfferBannerRequest
Requests a new offer banner to the SponsorPay server and notifies the registered
SPOfferBannerListener of the result of the request.
| Field Summary | |
|---|---|
private AsyncRequest |
mAsyncRequest
AsyncRequest used to send the request in the background. |
private java.lang.String |
mBaseDomain
Base domain of the request URL which will be passed to the WebView which displays the returned banner to load associated resources (like images). |
private java.lang.String |
mBaseUrl
BaseUrl of the resource from which the ad will be requested. |
private Context |
mContext
Android application context. |
private java.lang.String |
mCurrencyName
Currency Name to be sent in the request. |
private java.util.Map<java.lang.String,java.lang.String> |
mCustomParams
Map of custom key/values to add to the parameters on the OfferBanner request URL. |
private HostInfo |
mHostInfo
HostInfo instance containing the Application ID and data about the device. |
private SPOfferBannerListener |
mListener
Registered SPOfferBannerListener which will be notified of the result of the request. |
private OfferBanner.AdShape |
mOfferBannerAdShape
OfferBanner.AdShape whose description will be sent to the server in the request. |
private UserId |
mUserId
User ID to include in the request. |
private static java.lang.String |
OFFERBANNER_PRODUCTION_BASE_URL
|
private static java.lang.String |
OFFERBANNER_PRODUCTION_DOMAIN
|
private static java.lang.String |
OFFERBANNER_STAGING_BASE_URL
|
private static java.lang.String |
OFFERBANNER_STAGING_DOMAIN
|
private static java.lang.String |
STATE_OFFSET_COUNT_KEY
|
private static java.lang.String |
URL_PARAM_OFFERBANNER_KEY
|
| Constructor Summary | |
|---|---|
OfferBannerRequest(Context context,
java.lang.String userId,
HostInfo hostInfo,
SPOfferBannerListener listener,
OfferBanner.AdShape offerBannerAdShape,
java.lang.String currencyName,
java.util.Map<java.lang.String,java.lang.String> customParams)
Initializes a new instance and sends the request immediately. |
|
| Method Summary | |
|---|---|
private int |
fetchPersistedBannerOffset()
Fetches the persisted offset sent on the banner requests. |
private int |
fetchPersistedBannerOffset(SharedPreferences prefs)
Fetches the persisted offset sent on the banner requests. |
private SharedPreferences |
fetchSharedPreferences()
Returns the shared preferences file used by the Publisher functionality of the SponsorPay SDK. |
int |
getHttpStatusCode()
Gets the HTTP status code returned as a result of this request. |
java.lang.Exception |
getRequestException()
Deprecated. Use getRequestThrownError() instead, which returns a Throwable instance or null. This method will be removed in a future release. |
java.lang.Throwable |
getRequestThrownError()
Returns the local error thrown when trying to send the request. |
private void |
incrementPersistedBannerOffset()
Increments and persists the banner offset sent on every request to get different banners in a round-robin fashion. |
void |
onAsyncRequestComplete(AsyncRequest request)
Called by the mAsyncRequest instance when the background request's results are
available. |
private void |
requestOfferBanner()
Generates the request URL and sends it on the background. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String OFFERBANNER_PRODUCTION_BASE_URL
private static final java.lang.String OFFERBANNER_STAGING_BASE_URL
private static final java.lang.String OFFERBANNER_PRODUCTION_DOMAIN
private static final java.lang.String OFFERBANNER_STAGING_DOMAIN
private static final java.lang.String URL_PARAM_OFFERBANNER_KEY
private static final java.lang.String STATE_OFFSET_COUNT_KEY
private Context mContext
private SPOfferBannerListener mListener
SPOfferBannerListener which will be notified of the result of the request.
private UserId mUserId
private OfferBanner.AdShape mOfferBannerAdShape
OfferBanner.AdShape whose description will be sent to the server in the request.
private HostInfo mHostInfo
HostInfo instance containing the Application ID and data about the device.
private java.lang.String mBaseUrl
private java.lang.String mBaseDomain
private java.lang.String mCurrencyName
private java.util.Map<java.lang.String,java.lang.String> mCustomParams
private AsyncRequest mAsyncRequest
AsyncRequest used to send the request in the background.
| Constructor Detail |
|---|
public OfferBannerRequest(Context context,
java.lang.String userId,
HostInfo hostInfo,
SPOfferBannerListener listener,
OfferBanner.AdShape offerBannerAdShape,
java.lang.String currencyName,
java.util.Map<java.lang.String,java.lang.String> customParams)
context - Android application context.userId - ID of the user on whose behalf the banner will be requested.hostInfo - HostInfo instance containing the Application ID and data about the device.listener - SPOfferBannerListener which will be notified of the result of the request.offerBannerAdShape - OfferBanner.AdShape of the requested banner.currencyName - Currency Name to be sent in the request.customParams - A map of extra key/value pairs to add to the request URL.| Method Detail |
|---|
private void requestOfferBanner()
public void onAsyncRequestComplete(AsyncRequest request)
mAsyncRequest instance when the background request's results are
available. Will notify the registered SPOfferBannerListener.
onAsyncRequestComplete in interface AsyncRequest.AsyncRequestResultListenerprivate void incrementPersistedBannerOffset()
private SharedPreferences fetchSharedPreferences()
private int fetchPersistedBannerOffset()
private int fetchPersistedBannerOffset(SharedPreferences prefs)
prefs - The SharedPreferences instance which will be used to fetch this value.
public int getHttpStatusCode()
public java.lang.Exception getRequestException()
public java.lang.Throwable getRequestThrownError()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||