com.nativex.monetization
Class MonetizationSDK

java.lang.Object
  extended by com.nativex.monetization.MonetizationSDK

public class MonetizationSDK
extends Object

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.

Author:
Shravani.K

Field Summary
static int ACTION_RATE_APP
          A constant to use with the ClickListenerV2.
static int ACTION_UPGRADE_APP
          A constant to use with the ClickListenerV2.
 
Constructor Summary
MonetizationSDK()
           
 
Method Summary
 void createSession()
          Establishes a session with the NativeX servers.
 void createSession(com.nativex.monetization.listeners.SessionListener listener)
          Establishes a session with the NativeX servers.
 void enableLogging(boolean isEnabled)
          Enables or disables debug logging.
 void endSession()
          Ends the currently established session with the server.
 String getSessionId()
          Checks for session id and returns it if available.
 void initialize(Context context, ApplicationInputs inputs)
          Standard constructor for the MonetizationSDK object.
protected  void initialize(Context context, String appId, String applicationName, String packageName, String publisherUserId, com.nativex.monetization.enums.Language language, boolean willCallCreateSession)
          The initialization method called from the constructors.
 void redeemCurrency()
          This method checks to see if there is currency available to download and handles the processing of that currency.
 void release()
          Releases remaining memory allocation created by the offer wall.
 void upgradeMyApp(Activity context, DialogInputs inputs, com.nativex.monetization.listeners.ClickListenerBase clickListener)
          Shows a message dialog urging the user to upgrade the application in the Market.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_RATE_APP

public static final int ACTION_RATE_APP
A constant to use with the ClickListenerV2. Corresponds to RateMyApp action.

See Also:
Constant Field Values

ACTION_UPGRADE_APP

public static final int ACTION_UPGRADE_APP
A constant to use with the ClickListenerV2. Corresponds to UpgradeMyApp action.

See Also:
Constant Field Values
Constructor Detail

MonetizationSDK

public MonetizationSDK()
Method Detail

initialize

public void initialize(Context context,
                       ApplicationInputs inputs)
Standard constructor for the MonetizationSDK object.

Parameters:
context - The current application context.
inputs - ApplicationInputs. Bundle that contains application data.

initialize

protected void initialize(Context context,
                          String appId,
                          String applicationName,
                          String packageName,
                          String publisherUserId,
                          com.nativex.monetization.enums.Language language,
                          boolean willCallCreateSession)
The initialization method called from the constructors.

Parameters:
context - The current application context.
appId - The appId for this application.
applicationName - The name of the application.
publisherUserId - The user id for the current user. [Optional]
packageName - The package name for the application. com.something.somethingelse

enableLogging

public void enableLogging(boolean isEnabled)
Enables or disables debug logging.

Parameters:
isEnabled - Boolean. true - Log is enabled, false - no log.

release

public void release()
Releases remaining memory allocation created by the offer wall.


upgradeMyApp

public void upgradeMyApp(Activity context,
                         DialogInputs inputs,
                         com.nativex.monetization.listeners.ClickListenerBase clickListener)
Shows a message dialog urging the user to upgrade the application in the Market. If the user chooses to navigate to the Market, he or she is rewarded with in-game currency for taking that action. Transferring the currency to the user is handled by the game. The game will be notified if the user chooses to continue to the Market via the callback.

Parameters:
context - Activity. The activity to use when creating the dialog.
inputs - DialogInputs. The data to fill the dialog with.
clickListener - ClickListenerBase. This could be an implementation of ClickListenerV2 or ClickListenerV1 interfaces.

redeemCurrency

public void redeemCurrency()
This method checks to see if there is currency available to download and handles the processing of that currency. Results will be returned in the onRedeem() callback, which is part of the CurrencyListener interface.

Note: The network call is asynchronous.

Parameters:
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.
currencyListener - CurrencyListenerBase. This listener may be implementation of either CurrencyListenerV1 or CurrencyListenerV2.
showMessages - Boolean. A flag that indicates whether to suppress or show the dialog displaying how much virtual currency the user earned.

createSession

public void createSession(com.nativex.monetization.listeners.SessionListener listener)
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.

Parameters:
listener - SessionListener. The listener that will provide callback when the CreateSession request is done.

createSession

public void createSession()
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.


endSession

public void endSession()
Ends the currently established session with the server. This methods is intended only for custom implementations of the SDK . For standard implementation this call is included in the MonetizationManager.release() method.


getSessionId

public String getSessionId()
Checks for session id and returns it if available.

Returns:
String. The session id generated from the server or null if not available.