|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sponsorpay.sdk.android.publisher.SponsorPayPublisher
public class SponsorPayPublisher
Provides convenience calls to load and show the mobile Offer Wall and the mobile Interstitial.
Nested Class Summary | |
---|---|
static class |
SponsorPayPublisher.UIStringIdentifier
Enumeration identifying the different messages which can be displayed in the user interface. |
Field Summary | |
---|---|
static int |
DEFAULT_OFFERWALL_REQUEST_CODE
The default request code needed for starting the Offer Wall activity. |
static java.lang.String |
PREFERENCES_FILENAME
|
static int |
PUBLISHER_SDK_INTERNAL_VERSION
Publisher SDK version number sent to the server on each request. |
private static OfferBanner.AdShape |
sDefaultOfferBannerAdShape
Default OfferBanner.AdShape used to request Offer Banners to the backend. |
private static boolean |
sShouldUseStagingUrls
|
private static java.util.EnumMap<SponsorPayPublisher.UIStringIdentifier,java.lang.String> |
sUIStrings
Messages which can be displayed in the user interface. |
Constructor Summary | |
---|---|
SponsorPayPublisher()
|
Method Summary | |
---|---|
static Intent |
getIntentForOfferWallActivity(Context context,
java.lang.String userId)
Returns an Intent that can be used to launch the OfferWallActivity . |
static Intent |
getIntentForOfferWallActivity(Context context,
java.lang.String userId,
boolean shouldStayOpen)
Returns an Intent that can be used to launch the OfferWallActivity . |
static Intent |
getIntentForOfferWallActivity(Context context,
java.lang.String userId,
boolean shouldStayOpen,
java.lang.String overrideAppId)
Returns an Intent that can be used to launch the OfferWallActivity . |
static java.lang.String |
getUIString(SponsorPayPublisher.UIStringIdentifier identifier)
Gets a particular UI message identified by a SponsorPayPublisher.UIStringIdentifier . |
private static void |
initUIStrings()
Fills sUIStrings with the default messages. |
static void |
loadShowInterstitial(Activity callingActivity,
java.lang.String userId,
InterstitialLoader.InterstitialLoadingStatusListener loadingStatusListener)
Starts the mobile interstitial request / loading / showing process using default values for shouldStayOpen, backgroundUrl, skinName, loadingTimeoutSecs and retrieving the application id from the Android Manifest. |
static void |
loadShowInterstitial(Activity callingActivity,
java.lang.String userId,
InterstitialLoader.InterstitialLoadingStatusListener loadingStatusListener,
java.lang.Boolean shouldStayOpen)
Starts the mobile interstitial request / loading / showing process using default values for backgroundUrl, skinName, loadingTimeoutSecs and retrieving the application id from the Android Manifest. |
static void |
loadShowInterstitial(Activity callingActivity,
java.lang.String userId,
InterstitialLoader.InterstitialLoadingStatusListener loadingStatusListener,
java.lang.Boolean shouldStayOpen,
java.lang.String backgroundUrl,
java.lang.String skinName)
Starts the mobile interstitial request / loading / showing process using a default value for loadingTimeoutSecs and retrieving the application id from the Android Manifest. |
static void |
loadShowInterstitial(Activity callingActivity,
java.lang.String userId,
InterstitialLoader.InterstitialLoadingStatusListener loadingStatusListener,
java.lang.Boolean shouldStayOpen,
java.lang.String backgroundUrl,
java.lang.String skinName,
int loadingTimeoutSecs)
Starts the mobile interstitial request / loading / showing process retrieving the application id from the Android Manifest. |
static void |
loadShowInterstitial(Activity callingActivity,
java.lang.String userId,
InterstitialLoader.InterstitialLoadingStatusListener loadingStatusListener,
java.lang.Boolean shouldStayOpen,
java.lang.String backgroundUrl,
java.lang.String skinName,
int loadingTimeoutSecs,
java.lang.String overriddenAppId)
Starts the mobile interstitial request / loading / showing process. |
static void |
requestNewCoins(Context context,
java.lang.String userId,
SPCurrencyServerListener listener,
java.lang.String transactionId,
java.lang.String securityToken,
java.lang.String applicationId)
Sends a request to the SponsorPay currency server to obtain the variation in amount of virtual currency for a given user. |
static OfferBannerRequest |
requestOfferBanner(Context context,
java.lang.String userId,
SPOfferBannerListener listener,
OfferBanner.AdShape offerBannerAdShape,
java.lang.String currencyName,
java.lang.String applicationId)
Requests an Offer Banner to the SponsorPay servers and registers a listener which will be notified when a response is received. |
(package private) static void |
setCookiesIntoCookieManagerInstance(java.lang.String[] cookies,
java.lang.String baseUrl,
Context context)
Sets the provided cookie strings into the application's cookie manager for the given base URL. |
static void |
setCustomUIString(SponsorPayPublisher.UIStringIdentifier identifier,
int message,
Context context)
Replaces one of the UI messages with the text identified by an Android String resource id. |
static void |
setCustomUIString(SponsorPayPublisher.UIStringIdentifier identifier,
java.lang.String message)
Replaces one of the UI messages with a custom text. |
static void |
setCustomUIStrings(java.util.EnumMap<SponsorPayPublisher.UIStringIdentifier,java.lang.Integer> messages,
Context context)
|
static void |
setCustomUIStrings(java.util.EnumMap<SponsorPayPublisher.UIStringIdentifier,java.lang.String> messages)
Replaces one or several of the UI messages at once. |
static void |
setShouldUseStagingUrls(boolean value)
|
static boolean |
shouldUseStagingUrls()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PREFERENCES_FILENAME
public static final int PUBLISHER_SDK_INTERNAL_VERSION
private static java.util.EnumMap<SponsorPayPublisher.UIStringIdentifier,java.lang.String> sUIStrings
private static OfferBanner.AdShape sDefaultOfferBannerAdShape
OfferBanner.AdShape
used to request Offer Banners to the backend.
private static boolean sShouldUseStagingUrls
public static final int DEFAULT_OFFERWALL_REQUEST_CODE
Constructor Detail |
---|
public SponsorPayPublisher()
Method Detail |
---|
private static void initUIStrings()
sUIStrings
with the default messages.
public static java.lang.String getUIString(SponsorPayPublisher.UIStringIdentifier identifier)
SponsorPayPublisher.UIStringIdentifier
.
identifier
- The identifier of the message to get.
public static void setCustomUIString(SponsorPayPublisher.UIStringIdentifier identifier, java.lang.String message)
identifier
- The identifier of the message to set.message
- Custom text for the message.public static void setCustomUIStrings(java.util.EnumMap<SponsorPayPublisher.UIStringIdentifier,java.lang.String> messages)
messages
- An EnumMap mapping SponsorPayPublisher.UIStringIdentifier
s to the respective desired texts.public static void setCustomUIString(SponsorPayPublisher.UIStringIdentifier identifier, int message, Context context)
identifier
- The SponsorPayPublisher.UIStringIdentifier
of the message to replace.message
- An Android String resource identifier.context
- An Android context used to fetch the resourcepublic static void setCustomUIStrings(java.util.EnumMap<SponsorPayPublisher.UIStringIdentifier,java.lang.Integer> messages, Context context)
public static void setShouldUseStagingUrls(boolean value)
public static boolean shouldUseStagingUrls()
public static Intent getIntentForOfferWallActivity(Context context, java.lang.String userId)
Returns an Intent
that can be used to launch the OfferWallActivity
.
Will retrieve the publisher application id from the application manifest.
context
- The publisher application context.userId
- The current user ID of the host application.
Intent
which can be used with the Activity
method
startActivityForResult() to launch the OfferWallActivity
.public static Intent getIntentForOfferWallActivity(Context context, java.lang.String userId, boolean shouldStayOpen)
Returns an Intent
that can be used to launch the OfferWallActivity
. Lets the
caller specify the behavior of the Offer Wall once the user gets redirected out of the
application by clicking on an offer.
Will retrieve the publisher application id from the application manifest.
context
- The publisher application context.userId
- The current user ID of the host application.shouldStayOpen
- True if the Offer Wall should stay open after the user clicks on an offer and gets
redirected out of the app. False to close the Offer Wall.
Intent
which can be used with the Activity
method
startActivityForResult() to launch the OfferWallActivity
.public static Intent getIntentForOfferWallActivity(Context context, java.lang.String userId, boolean shouldStayOpen, java.lang.String overrideAppId)
Returns an Intent
that can be used to launch the OfferWallActivity
. Lets the
caller specify the behavior of the Offer Wall once the user gets redirected out of the
application by clicking on an offer.
Will use the provided publisher application id instead of trying to retrieve it from the application manifest.
context
- The publisher application context.userId
- The current user ID of the host application.shouldStayOpen
- True if the Offer Wall should stay open after the user clicks on an offer and gets
redirected out of the app. False to close the Offer Wall.overrideAppId
- An app ID which will override the one included in the manifest.
Intent
which can be used with the Activity
method
startActivityForResult() to launch the OfferWallActivity
.public static void loadShowInterstitial(Activity callingActivity, java.lang.String userId, InterstitialLoader.InterstitialLoadingStatusListener loadingStatusListener, java.lang.Boolean shouldStayOpen, java.lang.String backgroundUrl, java.lang.String skinName, int loadingTimeoutSecs, java.lang.String overriddenAppId)
callingActivity
- The activity which requests the interstitial. A progress dialog will be shown on
top of it and if an ad is returned, the calling activity will be used to launch
the InterstitialActivity
in order to show the ad.userId
- The current user ID of the host application.loadingStatusListener
- InterstitialLoader.InterstitialLoadingStatusListener
to register to be notified of events in
the interstitial lifecycle.shouldStayOpen
- Used to specify the behavior of the interstitial once the user clicks on the
presented ad and is redirected outside the host publisher app. The default
behavior is to close the interstitial and let the user go back to the activity
that called the interstitial when they come back to the app. If you want the
interstitial not to close until the user does it explicitly, set this parameter to
true.backgroundUrl
- Can be set to the absolute URL of an image to use as background graphic for the
interstitial. Must include the protocol scheme (http:// or https://) at the
beginning of the URL. Leave it null for no custom background.skinName
- Used to specify the name of a custom skin or template for the requested
interstitial. Leaving it null will make the interstitial fall back to the DEFAULT
template.loadingTimeoutSecs
- Sets the maximum amount of time the interstitial should take to load. If you set
it to 0 or a negative number, it will fall back to the default value of 5 seconds.overriddenAppId
- An app ID which will override the one included in the manifest.public static void loadShowInterstitial(Activity callingActivity, java.lang.String userId, InterstitialLoader.InterstitialLoadingStatusListener loadingStatusListener, java.lang.Boolean shouldStayOpen, java.lang.String backgroundUrl, java.lang.String skinName, int loadingTimeoutSecs)
callingActivity
- The activity which requests the interstitial. A progress dialog will be shown on
top of it and if an ad is returned, the calling activity will be used to launch
the InterstitialActivity
in order to show the ad.userId
- The current user ID of the host application.loadingStatusListener
- InterstitialLoader.InterstitialLoadingStatusListener
to register to be notified of events in
the interstitial lifecycle.shouldStayOpen
- Used to specify the behavior of the interstitial once the user clicks on the
presented ad and is redirected outside the host publisher app. The default
behavior is to close the interstitial and let the user go back to the activity
that called the interstitial when they come back to the app. If you want the
interstitial not to close until the user does it explicitly, set this parameter to
true.backgroundUrl
- Can be set to the absolute URL of an image to use as background graphic for the
interstitial. Must include the protocol scheme (http:// or https://) at the
beginning of the URL. Leave it null for no custom background.skinName
- Used to specify the name of a custom skin or template for the requested
interstitial. Leaving it null will make the interstitial fall back to the DEFAULT
template.loadingTimeoutSecs
- Sets the maximum amount of time the interstitial should take to load. If you set
it to 0 or a negative number, it will fall back to the default value of 5 seconds.public static void loadShowInterstitial(Activity callingActivity, java.lang.String userId, InterstitialLoader.InterstitialLoadingStatusListener loadingStatusListener, java.lang.Boolean shouldStayOpen, java.lang.String backgroundUrl, java.lang.String skinName)
callingActivity
- The activity which requests the interstitial. A progress dialog will be shown on
top of it and if an ad is returned, the calling activity will be used to launch
the InterstitialActivity
in order to show the ad.userId
- The current user ID of the host application.loadingStatusListener
- InterstitialLoader.InterstitialLoadingStatusListener
to register to be notified of events in
the interstitial lifecycle.shouldStayOpen
- Used to specify the behavior of the interstitial once the user clicks on the
presented ad and is redirected outside the host publisher app. The default
behavior is to close the interstitial and let the user go back to the activity
that called the interstitial when they come back to the app. If you want the
interstitial not to close until the user does it explicitly, set this parameter to
true.backgroundUrl
- Can be set to the absolute URL of an image to use as background graphic for the
interstitial. Must include the protocol scheme (http:// or https://) at the
beginning of the URL. Leave it null for no custom background.skinName
- Used to specify the name of a custom skin or template for the requested
interstitial. Leaving it null will make the interstitial fall back to the DEFAULT
template.public static void loadShowInterstitial(Activity callingActivity, java.lang.String userId, InterstitialLoader.InterstitialLoadingStatusListener loadingStatusListener, java.lang.Boolean shouldStayOpen)
callingActivity
- The activity which requests the interstitial. A progress dialog will be shown on
top of it and if an ad is returned, the calling activity will be used to launch
the InterstitialActivity
in order to show the ad.userId
- The current user ID of the host application.loadingStatusListener
- InterstitialLoader.InterstitialLoadingStatusListener
to register to be notified of events in
the interstitial lifecycle.shouldStayOpen
- Used to specify the behavior of the interstitial once the user clicks on the
presented ad and is redirected outside the host publisher app. The default
behavior is to close the interstitial and let the user go back to the activity
that called the interstitial when they come back to the app. If you want the
interstitial not to close until the user does it explicitly, set this parameter to
true.public static void loadShowInterstitial(Activity callingActivity, java.lang.String userId, InterstitialLoader.InterstitialLoadingStatusListener loadingStatusListener)
callingActivity
- The activity which requests the interstitial. A progress dialog will be shown on
top of it and if an ad is returned, the calling activity will be used to launch
the InterstitialActivity
in order to show the ad.userId
- The current user ID of the host application.loadingStatusListener
- InterstitialLoader.InterstitialLoadingStatusListener
to register to be notified of events in
the interstitial lifecycle.public static void requestNewCoins(Context context, java.lang.String userId, SPCurrencyServerListener listener, java.lang.String transactionId, java.lang.String securityToken, java.lang.String applicationId)
SPCurrencyServerListener
.
context
- Android application context.userId
- The ID of the user for which the delta of coins will be requested.listener
- SPCurrencyServerListener
which will be notified of the result of the
request.transactionId
- Optionally, provide the ID of the latest known transaction. The delta of coins
will be calculated from this transaction (not included) up to the present. Leave
it to null to let the SDK use the latest transaction ID it kept track of.securityToken
- Security Token associated with the provided Application ID. It's used to sign the
requests and verify the server responses.applicationId
- Application ID assigned by SponsorPay. Provide null to read the Application ID
from the Application Manifest.public static OfferBannerRequest requestOfferBanner(Context context, java.lang.String userId, SPOfferBannerListener listener, OfferBanner.AdShape offerBannerAdShape, java.lang.String currencyName, java.lang.String applicationId)
context
- Android application context.userId
- The ID of the user for whom the banner will be requested.listener
- SPOfferBannerListener
which will be notified of the results of the
request.offerBannerAdShape
- Provide null for this parameter to request a banner of the default dimensions (320
x 50).currencyName
- The name of the currency employed by your application. Provide null if you don't
use a custom currency name.applicationId
- Your Application ID, or null to retrieve it from your application manifest.
OfferBannerRequest
instance which manages the request to the server on the
background.static void setCookiesIntoCookieManagerInstance(java.lang.String[] cookies, java.lang.String baseUrl, Context context)
cookies
- An array of cookie strings.baseUrl
- The base URL to set the cookies for.context
- Android application context.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |