|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nativex.monetization.MonetizationManager
public class MonetizationManager
The entry point for the MonetizationSDK. This manager provides methods to call different ad types and offerwalls.
Note: When the application is closing release()
should be called to release the resources allocated by this manager.
Field Summary | |
---|---|
private static MonetizationManager |
instance
The manager is a singleton and this field contains the reference to the only instance of this object. |
private MonetizationSDK |
monetizationSDK
The instance of SDK wrapper class. |
Constructor Summary | |
---|---|
private |
MonetizationManager()
The class is singleton and the constructor is private. |
Method Summary | |
---|---|
static void |
actionTaken(int actionId)
The ActionTaken operation calls back to the nativeX servers and communicates that a trackable action has completed. |
private static void |
checkInstance()
This method checks for an instance of the manager and if there is no instance it throws NullPointerException . |
private static void |
checkPlacementName(String name,
String apiname)
This method checks for null or empty string for placement name,if found throws NullPointerException . |
private static void |
checkPosition(Rect position,
com.nativex.monetization.enums.BannerPosition enumPosition,
String placementName)
|
private static void |
createInstance()
|
static void |
createSession()
Deprecated. Use the createSession(context,appId,sessionListener) Establishes a session with the NativeX servers. The session is registering the device with our servers and personalizes the offer selection for it. Note: The network call is asynchronous. |
static void |
createSession(Context context,
ApplicationInputs inputs,
com.nativex.monetization.listeners.SessionListener listener)
Establishes a session with the NativeX servers. |
static void |
createSession(Context context,
String appId,
com.nativex.monetization.listeners.SessionListener listener)
Establishes a session with the NativeX servers. |
static void |
createSession(Context context,
String appId,
String publisherUserId,
com.nativex.monetization.listeners.SessionListener listener)
Establishes a session with the NativeX servers. |
static void |
createSession(com.nativex.monetization.listeners.SessionListener listener)
Deprecated. Use the createSession(context,appId,sessionListener) Establishes a session with the NativeX servers. The session is registering the device with our servers and personalizes the offer selection for it. Accepts a callback interface implementation. Note: The network call is asynchronous. |
static void |
dismissAd(com.nativex.monetization.enums.NativeXAdPlacement name)
Removes an ad from the screen and releases it's resources. |
static void |
dismissAd(String customPlacement)
Removes an ad from the screen and releases it's resources. |
static void |
dismissBannerAd(com.nativex.monetization.enums.NativeXAdPlacement name)
Removes a banner from the screen and releases it's resources. |
static void |
dismissBannerAd(String customPlacement)
Removes a banner from the screen and releases it's resources. |
static void |
enableLogging(boolean isEnabled)
Enables the SDK logging. |
static void |
endSession()
Ends the currently established session with the server. |
static void |
fetchAd(Activity activity,
com.nativex.monetization.enums.NativeXAdPlacement name,
com.nativex.monetization.listeners.OnAdEvent listener)
Fetches an ad and stores in the memory ready to be shown. |
static void |
fetchAd(Activity activity,
String customPlacement,
com.nativex.monetization.listeners.OnAdEvent listener)
Fetches an ad and stores it in the memory ready to be shown. |
static void |
fetchBannerAd(Activity activity,
com.nativex.monetization.enums.NativeXAdPlacement name,
com.nativex.monetization.listeners.OnAdEvent listener)
Fetches a banner and stores it in the memory ready to be shown. |
static void |
fetchBannerAd(Activity activity,
String customPlacement,
com.nativex.monetization.listeners.OnAdEvent listener)
Fetches a banner and stores it in the memory ready to be shown. |
static String |
getSessionId()
Checks for session id and returns it if available. |
static void |
initialize(Activity context,
ApplicationInputs inputs)
Deprecated. Use the createSession(context,appId,sessionListener) Initializes the SDK. This method initializes various managers that the SDK requires to run. This methods accepts the application data as a bundle. |
static void |
initialize(Activity context,
String applicationName,
int appId,
String publisherUserId,
String packageName)
Deprecated. Use the createSession(context,appId,sessionListener) Initializes the SDK. This method initializes various managers that the SDK requires to run. This method accepts the application data as parameters. |
static boolean |
isInitialized()
Checks if this manager is initialized. |
static void |
redeemCurrency()
Sends RedeemCurrency network call to the server. |
static void |
release()
Releases the resources allocated by the SDK and ends the currently established session. |
static void |
reloadBannerAd(com.nativex.monetization.enums.NativeXAdPlacement name)
Loads new ad in a banner. |
static void |
reloadBannerAd(String customPlacement)
Loads new ad in a banner. |
static void |
setAdvertiserListener(AdvertiserListener listener)
The AdvertiserListener is used to provide callback for ActionTaken server operation. |
static void |
setBannerAdPosition(com.nativex.monetization.enums.NativeXAdPlacement name,
com.nativex.monetization.enums.BannerPosition position)
Sets the custom position of a banner. |
static void |
setBannerAdPosition(com.nativex.monetization.enums.NativeXAdPlacement name,
Rect position)
Sets the custom position of a banner. |
static void |
setBannerAdPosition(String customPlacement,
com.nativex.monetization.enums.BannerPosition position)
Sets the custom position of a banner. |
static void |
setBannerAdPosition(String customPlacement,
Rect position)
Sets the custom position of a banner. |
static void |
setCurrencyListener(com.nativex.monetization.listeners.CurrencyListenerBase listener)
Sets a listener in the SDK that will provide callback when the user completes an offer and is awarded with virtual currency. |
static void |
setTheme(com.nativex.monetization.theme.Theme theme)
Sets the theme of the SDK. |
static void |
showAd(Activity activity,
com.nativex.monetization.enums.NativeXAdPlacement name)
Show an ad. |
static void |
showAd(Activity activity,
com.nativex.monetization.enums.NativeXAdPlacement name,
com.nativex.monetization.listeners.OnAdEvent listener)
Show an ad. |
static void |
showAd(Activity activity,
String customPlacement)
Show an ad. |
static void |
showAd(Activity activity,
String customPlacement,
com.nativex.monetization.listeners.OnAdEvent listener)
Show an ad. |
static void |
showBannerAd(Activity activity,
com.nativex.monetization.enums.NativeXAdPlacement placement,
com.nativex.monetization.enums.BannerPosition position)
Shows a banner. |
static void |
showBannerAd(Activity activity,
com.nativex.monetization.enums.NativeXAdPlacement name,
com.nativex.monetization.enums.BannerPosition position,
com.nativex.monetization.listeners.OnAdEvent listener)
Shows a banner ad. |
static void |
showBannerAd(Activity activity,
com.nativex.monetization.enums.NativeXAdPlacement name,
Rect position,
com.nativex.monetization.listeners.OnAdEvent listener)
Shows a banner ad. |
static void |
showBannerAd(Activity activity,
String customPlacement,
com.nativex.monetization.enums.BannerPosition position)
Shows a banner. |
static void |
showBannerAd(Activity activity,
String customPlacement,
com.nativex.monetization.enums.BannerPosition position,
com.nativex.monetization.listeners.OnAdEvent listener)
Shows a banner ad. |
static void |
showBannerAd(Activity activity,
String customPlacement,
Rect position)
Shows a banner. |
private static void |
showBannerAd(Activity activity,
String customPlacement,
Rect position,
com.nativex.monetization.enums.BannerPosition adPosition,
com.nativex.monetization.listeners.OnAdEvent listener)
|
static void |
showBannerAd(Activity activity,
String customPlacement,
Rect position,
com.nativex.monetization.listeners.OnAdEvent listener)
Shows a banner ad. |
static void |
trackInAppPurchase(com.nativex.common.billingtracking.BillingInputs inputs)
Sends a tracking call to the server with information about a purchase that the user completed. |
static void |
trackInAppPurchase(String storeProductId,
String storeTransactionId,
String storeTransactionTimeUTC,
float costPerItem,
String currencyLocale,
int quantity,
String productTitle)
Sends a tracking call to the server with information about a purchase that the user completed. |
static void |
update(Activity activity)
In case the activity needs to be recreated (due to configuration change for example), the banner has to be detached from the old instance and re-attached to the new one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static MonetizationManager instance
private MonetizationSDK monetizationSDK
Constructor Detail |
---|
private MonetizationManager()
Method Detail |
---|
private static void checkInstance()
NullPointerException
.
NullPointerException
- This exception is thrown when the manager is not initialized.private static void createInstance()
@Deprecated public static void initialize(Activity context, ApplicationInputs inputs)
context
- Constants
. The context instance is required for the SDK to be able to create UI elements like the offerwall.inputs
- ApplicationInputs
. The application data is passed here as a bundle.@Deprecated public static void initialize(Activity context, String applicationName, int appId, String publisherUserId, String packageName)
context
- Constants
. The context instance is required for the SDK to be able to create UI elements like the offerwall.applicationName
- String
. The application name to display in the offerwall.appId
- Integer
. The appId provided by NativeX support team for your app.publisherUserId
- String
. This is developer payload.packageName
- String
. The package name of the application.@Deprecated public static void createSession()
@Deprecated public static void createSession(com.nativex.monetization.listeners.SessionListener listener)
listener
- SessionListener
. The listener that will provide callback when the CreateSession request is done.public static void createSession(Context context, String appId, com.nativex.monetization.listeners.SessionListener listener)
context
- Constants
. The context instance is required for the SDK to be able to create UI elements like the offerwall.appId
- String
. The appId provided by NativeX support team for your app.listener
- SessionListener
. The listener that will provide callback when the CreateSession request is done.public static void createSession(Context context, String appId, String publisherUserId, com.nativex.monetization.listeners.SessionListener listener)
context
- Constants
. The context instance is required for the SDK to be able to create UI elements like the offerwall.appId
- String
. The appId provided by NativeX support team for your app.publisherUserId
- String
. This is developer payload.listener
- SessionListener
. The listener that will provide callback when the CreateSession request is done.public static void createSession(Context context, ApplicationInputs inputs, com.nativex.monetization.listeners.SessionListener listener)
context
- Constants
. The context instance is required for the SDK to be able to create UI elements like the offerwall.inputs
- ApplicationInputs
. Bundle that contains application data.listener
- SessionListener
. The listener that will provide callback when the CreateSession request is done.public static void actionTaken(int actionId)
actionId
- The action id is provided by nativeX and identifies the particular action that your app is tracking.public static void setCurrencyListener(com.nativex.monetization.listeners.CurrencyListenerBase listener)
listener
- CurrencyListenerBase
. This listener may be implementation of either CurrencyListenerV1
or CurrencyListenerV2
.public static void setAdvertiserListener(AdvertiserListener listener)
listener
- AdvertiserListener
. An implementation of AdvertiserListener.public static void redeemCurrency()
context
- Activity
. The activity is required for the dialog that will pop when the network call is completed and there are virtual currencies awarded to the user.public static void enableLogging(boolean isEnabled)
isEnabled
- Boolean
.true - enabled, false - no log.public static void endSession()
release()
method.
public static String getSessionId()
String
. The session id generated from the server or null if not available.public static void trackInAppPurchase(com.nativex.common.billingtracking.BillingInputs inputs)
inputs
- BillingInputs
. A bundle with information about the purchase to send to the server.public static void trackInAppPurchase(String storeProductId, String storeTransactionId, String storeTransactionTimeUTC, float costPerItem, String currencyLocale, int quantity, String productTitle)
storeProductId
- String
The product id of the store item.storeTransactionId
- String
The transaction id.storeTransactionTimeUTC
- String
The time the purchase was performed.costPerItem
- Float
The cost of the item.currencyLocale
- String
The locale of the currency used to pay for the purchase.quantity
- Integer
The quantity of items purchased.productTitle
- String
The name of the product.public static void setTheme(com.nativex.monetization.theme.Theme theme)
theme
- Theme
. The theme for the SDK visual elements to use.public static boolean isInitialized()
Boolean
. true - the manager is initialized, false - call initialize().public static void release()
public static final void showAd(Activity activity, com.nativex.monetization.enums.NativeXAdPlacement name)
activity
- Activity
. The activity to create the ad visual elements from.name
- NativeXAdPlacement
. A pre-defined list of strings describing the interaction point of an ad within your game.public static final void showAd(Activity activity, String customPlacement)
activity
- Activity
. The activity to create the ad visual elements from.customPlacement
- String
. A string that describes the interaction point of an ad within your game.public static final void showAd(Activity activity, com.nativex.monetization.enums.NativeXAdPlacement name, com.nativex.monetization.listeners.OnAdEvent listener)
activity
- Activity
. The activity to create the ad visual elements from.name
- NativeXAdPlacement
. A pre-defined list of strings describing the interaction point of an ad within your game.listener
- OnAdEvent
. An implementation of OnAdEvent interface to provide callback.public static final void showAd(Activity activity, String customPlacement, com.nativex.monetization.listeners.OnAdEvent listener)
activity
- Activity
. The activity to create the ad visual elements from.customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.listener
- OnAdEvent
. An implementation of OnAdEvent interface to provide callback.public static final void showBannerAd(Activity activity, String customPlacement, Rect position)
activity
- Activity
. The activity to create the ad visual elements from.customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.position
- Rect
. A Rect that describes the position of the ad.public static final void showBannerAd(Activity activity, String customPlacement, com.nativex.monetization.enums.BannerPosition position)
activity
- Activity
. The activity to create the ad visual elements from.customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.position
- BannerPosition
. Choose a predefined position.public static final void showBannerAd(Activity activity, com.nativex.monetization.enums.NativeXAdPlacement placement, com.nativex.monetization.enums.BannerPosition position)
activity
- Activity
. The activity to create the ad visual elements from.placement
- NativeXAdPlacement
. Default placement categories used as the name of the ad configurable on the NativeX self-service web site.position
- BannerPosition
. Choose a predefined position.public static final void showBannerAd(Activity activity, com.nativex.monetization.enums.NativeXAdPlacement name, Rect position, com.nativex.monetization.listeners.OnAdEvent listener)
activity
- Activity
. The activity to create the ad visual elements from.name
- NativeXAdPlacement
. Default placement categories used as the name of the ad configurable on the NativeX self-service web site.position
- Rect
. A Rect that describes the position of the ad.public static final void showBannerAd(Activity activity, com.nativex.monetization.enums.NativeXAdPlacement name, com.nativex.monetization.enums.BannerPosition position, com.nativex.monetization.listeners.OnAdEvent listener)
activity
- Activity
. The activity to create the ad visual elements from.name
- NativeXAdPlacement
. Default placement categories used as the name of the ad configurable on the NativeX self-service web site.position
- BannerPosition
. Choose a predefined position.public static final void showBannerAd(Activity activity, String customPlacement, Rect position, com.nativex.monetization.listeners.OnAdEvent listener)
activity
- Activity
. The activity to create the ad visual elements from.customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.position
- Rect
. A Rect that describes the position of the ad.public static final void showBannerAd(Activity activity, String customPlacement, com.nativex.monetization.enums.BannerPosition position, com.nativex.monetization.listeners.OnAdEvent listener)
activity
- Activity
. The activity to create the ad visual elements from.customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.position
- BannerPosition
. Choose a predefined position.private static final void showBannerAd(Activity activity, String customPlacement, Rect position, com.nativex.monetization.enums.BannerPosition adPosition, com.nativex.monetization.listeners.OnAdEvent listener)
private static final void checkPosition(Rect position, com.nativex.monetization.enums.BannerPosition enumPosition, String placementName)
public static final void update(Activity activity)
activity
- Activity
. The activity to update the ad with.public static final void fetchAd(Activity activity, com.nativex.monetization.enums.NativeXAdPlacement name, com.nativex.monetization.listeners.OnAdEvent listener)
activity
- Activity
. The activity to create the ad visual elements from.name
- NativeXAdPlacement
. A pre-defined list of strings describing the interaction point of an ad within your game.listener
- OnAdEvent
. An implementation of OnAdEvent interface to provide callback.public static final void fetchAd(Activity activity, String customPlacement, com.nativex.monetization.listeners.OnAdEvent listener)
activity
- Activity
. The activity to create the ad visual elements from.customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.listener
- OnAdEvent
. An implementation of OnAdEvent interface to provide callback.public static final void fetchBannerAd(Activity activity, com.nativex.monetization.enums.NativeXAdPlacement name, com.nativex.monetization.listeners.OnAdEvent listener)
activity
- Activity
. The activity to create the ad visual elements from.name
- NativeXAdPlacement
. Default placement categories used as the name of the ad configurable on the NativeX self-service web site.listener
- OnAdEvent
. An implementation of OnAdEvent interface to provide callback.public static final void fetchBannerAd(Activity activity, String customPlacement, com.nativex.monetization.listeners.OnAdEvent listener)
activity
- Activity
. The activity to create the ad visual elements from.customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.public static final void reloadBannerAd(com.nativex.monetization.enums.NativeXAdPlacement name)
name
- NativeXAdPlacement
. Default placement categories used as the name of the ad configurable on the NativeX self-service web site.public static final void reloadBannerAd(String customPlacement)
customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.public static final void setBannerAdPosition(com.nativex.monetization.enums.NativeXAdPlacement name, Rect position)
name
- NativeXAdPlacement
. Default placement categories used as the name of the ad configurable on the NativeX self-service web site.position
- Rect
. A Rect that describes the position of the ad.public static final void setBannerAdPosition(com.nativex.monetization.enums.NativeXAdPlacement name, com.nativex.monetization.enums.BannerPosition position)
name
- NativeXAdPlacement
. Default placement categories used as the name of the ad configurable on the NativeX self-service web site.position
- BannerPosition
. Choose a predefined position.public static final void setBannerAdPosition(String customPlacement, com.nativex.monetization.enums.BannerPosition position)
customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.position
- BannerPosition
. Choose a predefined position.public static final void setBannerAdPosition(String customPlacement, Rect position)
customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.position
- Rect
. A Rect that describes the position of the ad.public static final void dismissBannerAd(com.nativex.monetization.enums.NativeXAdPlacement name)
name
- NativeXAdPlacement
. Default placement categories used as the name of the ad configurable on the NativeX self-service web site.public static final void dismissBannerAd(String customPlacement)
customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.public static final void dismissAd(com.nativex.monetization.enums.NativeXAdPlacement name)
name
- NativeXAdPlacement
. A pre-defined list of strings describing the interaction point of an ad within your game.public static final void dismissAd(String customPlacement)
customPlacement
- String
. The name of the ad configurable on the NativeX self-service web site.private static void checkPlacementName(String name, String apiname)
NullPointerException
.
NullPointerException
- This exception is thrown when the placement name is null or empty string.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |