Modifier and Type | Field and Description |
---|---|
(package private) String |
advertisingClientClassName
Class names used in reflection to fetch advertiserId
|
(package private) String |
advertisingInfoClassName |
private static HandlerThread |
handlerThread
HandlerThread has looper in it unlike normal Thread.
|
private boolean |
isAdvertiserIdTaskRunning
Indicates fetch advertiserId thread is running
|
private static Handler |
threadHandler
Handler created from HandlerThread.
|
Constructor and Description |
---|
MonetizationSDK() |
Modifier and Type | Method and Description |
---|---|
void |
continueWithCreateSession(com.nativex.monetization.listeners.SessionListener listener) |
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.
|
private void |
fetchAdvertiserInfoAndCreateSession(com.nativex.monetization.listeners.SessionListener listener)
The 'getAdvertisingIdInfo()' method is a blocking call, so you must not call it on the main (UI) thread.
|
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,
boolean willCallCreateSession)
The initialization method called from the constructors.
|
void |
monetizationSDKRelease() |
void |
redeemCurrency()
This method checks to see if there is currency available to download and handles the processing of that currency.
|
void |
release()
Releases all the allocated resources.
|
private void |
setAdvertiserIdInfo()
Uses reflection to access necessary classes and methods from google play services jar
and gets the advertiserId and isLimitdAdTracking values.
|
private boolean isAdvertiserIdTaskRunning
final String advertisingClientClassName
final String advertisingInfoClassName
private static HandlerThread handlerThread
private static Handler threadHandler
public void initialize(Context context, ApplicationInputs inputs)
context
- The current application context.inputs
- ApplicationInputs
. Bundle that contains application data.protected void initialize(Context context, String appId, String applicationName, String packageName, String publisherUserId, boolean willCallCreateSession)
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.somethingelsepublic void enableLogging(boolean isEnabled)
isEnabled
- Boolean
. true - Log is enabled, false - no log.public void release()
public void monetizationSDKRelease()
public 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.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.public void createSession(com.nativex.monetization.listeners.SessionListener listener)
listener
- SessionListener
. The listener that will provide callback when the CreateSession request is done.public void createSession()
private void fetchAdvertiserInfoAndCreateSession(com.nativex.monetization.listeners.SessionListener listener)
listener
- SessionListener
. The listener that will provide callback when the CreateSession request is done.public void continueWithCreateSession(com.nativex.monetization.listeners.SessionListener listener)
private void setAdvertiserIdInfo()