public class Tune extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
collectLocation |
protected TuneEventQueue |
eventQueue |
protected boolean |
initialized |
protected boolean |
isFirstInstall |
protected boolean |
isRegistered |
protected TuneLocationListener |
locationListener |
protected android.content.Context |
mContext |
protected android.content.BroadcastReceiver |
networkStateReceiver |
protected TuneParameters |
params |
protected ExecutorService |
pubQueue |
protected long |
timeLastMeasuredSession |
protected TuneTestRequest |
tuneRequest |
Modifier | Constructor and Description |
---|---|
protected |
Tune() |
Modifier and Type | Method and Description |
---|---|
protected void |
addEventToQueue(String link,
String data,
org.json.JSONObject postBody,
boolean firstSession) |
void |
checkForDeferredDeeplink(TuneDeeplinkListener listener)
Deprecated.
Instead, register your
TuneDeeplinkListener via registerDeeplinkListener(TuneDeeplinkListener) . As of Tune Android SDK v4.8.0 this method delegates to registerDeeplinkListener(TuneDeeplinkListener) so that there is only ever one listener at a time. This method is planned for removal in Tune Android SDK v5.0.0. |
void |
clearAllCustomProfileVariables()
Clear out all previously specified profile information.
Use this method to clear out all custom profile variables. |
void |
clearCustomProfileVariable(String variableName)
Unset the value for a user profile variable.
Use this method to clear out the value for any custom user profile variable. |
void |
configureSmartwhere(TuneSmartwhereConfiguration config)
Configure Smartwhere using a configuration.
|
boolean |
didSessionStartFromTunePush()
Returns if the current session is because the user opened a push notification.
|
boolean |
didUserManuallyDisablePush()
Returns if the user manually disabled push on the Application Setting page.
|
void |
disableSmartwhere()
Disable Smartwhere Integration.
|
protected void |
dumpQueue() |
void |
enableSmartwhere()
Opt-In Smartwhere Integration with the Tune Marketing Console.
|
void |
executeDeepAction(android.app.Activity activity,
String actionId,
Map<String,String> data)
Executes a previously registered Deep Action code-block.
|
String |
getAction()
Gets the action of the event
|
String |
getAdvertiserId()
Gets the TUNE advertiser ID.
|
int |
getAge()
Gets the user age.
|
double |
getAltitude()
Gets the device altitude.
|
String |
getAndroidId()
Gets the ANDROID_ID of the device that was set with
setAndroidId(String) |
boolean |
getAppAdTrackingEnabled()
Get whether the user has app-level ad tracking enabled or not.
|
String |
getAppId()
Returns In-App Marketing's generated app ID value
|
String |
getAppName()
Gets the app name
|
int |
getAppVersion()
Gets the app version
|
String |
getConnectionType()
Gets the connection type (mobile or WIFI);.
|
String |
getCountryCode()
Gets the ISO 639-1 country code
|
String |
getCurrencyCode()
Gets the ISO 4217 currency code.
|
Date |
getCustomProfileDate(String variableName)
Get the value associated with a custom date profile variable.
|
TuneLocation |
getCustomProfileGeolocation(String variableName)
Get the value associated with a custom location profile variable.
|
Number |
getCustomProfileNumber(String variableName)
Get the value associated with a custom number profile variable.
|
String |
getCustomProfileString(String variableName)
Get the value associated with a custom string profile variable.
|
String |
getDeviceBrand()
Gets the device brand/manufacturer (HTC, Apple, etc)
|
String |
getDeviceBuild()
Gets the device build
|
String |
getDeviceCarrier()
Gets the device carrier if any
|
String |
getDeviceId()
Gets the Device ID, also known as IMEI/MEID, if any
|
String |
getDeviceModel()
Gets the device model name
|
String |
getDeviceToken()
Returns the currently registered device token for push.
|
boolean |
getExistingUser()
Gets value previously set of existing user or not.
|
String |
getFacebookUserId()
Gets the Facebook user ID previously set.
|
boolean |
getFireAdTrackingLimited()
Gets whether use of the Fire Advertising ID is limited by user request.
|
String |
getFireAdvertisingId()
Gets the Fire Advertising ID.
|
TuneGender |
getGender()
Gets the user gender set with
setGender(TuneGender) . |
boolean |
getGoogleAdTrackingLimited()
Gets whether use of the Google Play Services Advertising ID is limited by user request.
|
String |
getGoogleAdvertisingId()
Gets the Google Play Services Advertising ID.
|
String |
getGoogleUserId()
Gets the Google user ID previously set.
|
Map<String,TuneInAppMessageExperimentDetails> |
getInAppMessageExperimentDetails()
Get details for all currently running In App Message experiments.
|
Map<String,TuneInAppMessage> |
getInAppMessagesByIds()
Get all in-app messages that can be shown for this device, sorted by message variation id.
|
Map<String,List<TuneInAppMessage>> |
getInAppMessagesByTriggerEvents()
Get all in-app messages that can be shown for this device, sorted by trigger event.
|
List<TuneInAppMessage> |
getInAppMessagesForCustomEvent(String eventName)
Get in-app messages for this device that are triggered by custom event.
|
List<TuneInAppMessage> |
getInAppMessagesForPushEnabled(boolean pushEnabled)
Get in-app messages for this device that are triggered by a Push Enabled/Disabled event.
|
List<TuneInAppMessage> |
getInAppMessagesForPushOpened(String pushId)
Get in-app messages for this device that are triggered by a push opened event for a specific TUNE push message.
|
List<TuneInAppMessage> |
getInAppMessagesForScreenViewed(String activityName)
Get in-app messages for this device that are triggered by a Screen Viewed event.
|
List<TuneInAppMessage> |
getInAppMessagesForStartsApp()
Get in-app messages for this device that are triggered by a "Starts App" event.
|
long |
getInstallDate()
Gets the date of app install
|
String |
getInstallReferrer()
Gets the Google Play INSTALL_REFERRER
|
static Tune |
getInstance()
Get existing TUNE singleton object
|
boolean |
getIsPayingUser()
Gets whether the user is revenue-generating or not
|
String |
getLanguage()
Gets the language of the device
|
String |
getLastOpenLogId()
Gets the last TUNE open log ID
|
double |
getLatitude()
Gets the device latitude.
|
String |
getLocale()
Gets the device locale.
|
double |
getLongitude()
Gets the device longitude.
|
String |
getMacAddress()
Gets the MAC address of device
|
String |
getMatId()
Gets the MAT ID generated on install
|
String |
getMCC()
Gets the mobile country code.
|
String |
getMNC()
Gets the mobile network code.
|
String |
getOpenLogId()
Gets the first TUNE open log ID
|
String |
getOsVersion()
Gets the Android OS version
|
String |
getPackageName()
Gets the app package name
|
String |
getPluginName()
Get SDK plugin name used
|
Map<String,TunePowerHookExperimentDetails> |
getPowerHookExperimentDetails()
Get details for all currently running Power Hook Variable experiments.
|
String |
getReferralSource()
Gets the package name of the app that started this Activity, if any
|
String |
getReferralUrl()
Gets the url scheme that started this Activity, if any
|
String |
getScreenDensity()
Gets the screen density of the device
|
String |
getScreenHeight()
Gets the screen height of the device in pixels
|
String |
getScreenWidth()
Gets the screen width of the device in pixels
|
static String |
getSDKVersion()
Gets the TUNE Android SDK version
|
long |
getTimeLastMeasuredSession()
Get the time the Tune SDK last measured a new session.
|
String |
getTRUSTeId()
Gets the TRUSTe ID set
|
TuneParameters |
getTuneParams() |
TunePushInfo |
getTunePushInfoForSession()
Returns a POJO containing information about the push message that started the current session.
|
String |
getTwitterUserId()
Gets the Twitter user ID previously set.
|
String |
getUserAgent()
Gets the device browser user agent
|
String |
getUserEmail()
Gets the custom user email.
|
String |
getUserId()
Gets the custom user ID.
|
String |
getUserName()
Gets the custom user name.
|
String |
getValueForHookById(String hookId)
Gets the value of a Power Hook.
|
static Tune |
init(android.content.Context context,
String advertiserId,
String conversionKey)
Initializes the TUNE SDK with TMA off by default.
|
static Tune |
init(android.content.Context context,
String advertiserId,
String conversionKey,
boolean turnOnIAM)
Initializes the TUNE SDK.
|
static Tune |
init(android.content.Context context,
String advertiserId,
String conversionKey,
boolean turnOnIAM,
TuneConfiguration configuration)
Initializes the TUNE SDK.
|
protected void |
initAll(String advertiserId,
String conversionKey)
Private initialization function for TUNE SDK.
|
protected TuneOptional<String> |
invokeUrlFromReferralUrl(String referralUrl) |
boolean |
isInDebugMode()
Checks the current status of debug mode.
|
static boolean |
isOnline(android.content.Context context)
Returns true if an Internet connection is detected.
|
boolean |
isTuneLink(String appLinkUrl)
Test if your custom Tune Link domain is registered with Tune.
|
boolean |
isUserInAnySegmentIds(List<String> segmentIds)
Returns whether the user belongs to any of the given segments.
|
boolean |
isUserInSegmentId(String segmentId)
Returns whether the user belongs to the given segment.
|
protected boolean |
makeRequest(String link,
String data,
org.json.JSONObject postBody)
Helper function for making single request and displaying response
|
void |
measureEvent(int eventId)
Deprecated.
TUNE does not support measuring events using event IDs. Please use
measureEvent(String) or measureEvent(TuneEvent) methods. This method will be removed in Tune Android SDK v5.0.0 |
void |
measureEvent(String eventName)
Event measurement function that measures an event for the given eventName.
|
void |
measureEvent(TuneEvent eventData)
Event measurement function that measures an event based on TuneEvent values.
|
void |
measureSession()
Deprecated.
As of Tune Android SDK v4.8.0 you do not need to explicitly call this method for native Tune Android SDK integrations.
The session will be measured as part of the call to TuneActivity's onResume, which may be called automatically with the
activity lifecycle callbacks registered via your Application class as part of the normal Tune SDK integration.
Tune Android SDK plugins should call
measureSessionInternal() instead. This method will be removed in Tune Android SDK v5.0.0 |
void |
measureSessionInternal()
Measure new session.
|
void |
onFirstPlaylistDownloaded(TuneCallback callback)
Register callback when the first playlist is downloaded for App's lifetime.
|
void |
onFirstPlaylistDownloaded(TuneCallback callback,
long timeout)
Register callback when the first playlist is downloaded for the App's lifetime.
|
void |
onPowerHooksChanged(TuneCallback callback)
Register a callback when any Power Hooks have changed due to a new value from the Server.
|
void |
preloadMessages(android.app.Activity activity)
Preload all messages in a given Activity, so they're ready to be shown quickly
|
void |
preloadMessagesForCustomEvent(android.app.Activity activity,
String eventName)
Preload all messages that are triggered by given custom event
|
void |
preloadMessageWithId(android.app.Activity activity,
String messageId)
Preload a single message with given message ID
|
void |
registerCustomProfileDate(String variableName)
Register a custom profile variable for this user.
This custom variable will be included in this user's personalization profile, and can be used for segmentation, targeting, and reporting purposes. Once registered, the value for this variable can be set using setCustomProfileDate(String, Date) . |
void |
registerCustomProfileDate(String variableName,
Date defaultValue)
Register a custom profile variable for this user.
This custom variable will be included in this user's personalization profile, and can be used for segmentation, targeting, and reporting purposes. Once registered, the value for this variable can be set using setCustomProfileDate(String, Date) . |
void |
registerCustomProfileGeolocation(String variableName)
Register a custom profile variable for this user.
This custom variable will be included in this user's personalization profile, and can be used for segmentation, targeting, and reporting purposes. Once registered, the value for this variable can be set using setCustomProfileGeolocation(String, TuneLocation) . |
void |
registerCustomProfileGeolocation(String variableName,
TuneLocation defaultValue)
Register a custom profile variable for this user.
This custom variable will be included in this user's personalization profile, and can be used for segmentation, targeting, and reporting purposes. Once registered, the value for this variable can be set using setCustomProfileGeolocation(String, TuneLocation) . |
void |
registerCustomProfileNumber(String variableName)
Register a custom profile variable for this user.
This custom variable will be included in this user's personalization profile, and can be used for segmentation, targeting, and reporting purposes. Once registered, the value for this variable can be set using setCustomProfileNumber(String, double) , setCustomProfileNumber(String, float) , or setCustomProfileNumber(String, int) . |
void |
registerCustomProfileNumber(String variableName,
double defaultValue)
Register a custom profile variable for this user.
This custom variable will be included in this user's personalization profile, and can be used for segmentation, targeting, and reporting purposes. Once registered, the value for this variable can be set using setCustomProfileNumber(String, double) , setCustomProfileNumber(String, float) , or setCustomProfileNumber(String, int) . |
void |
registerCustomProfileNumber(String variableName,
float defaultValue)
Register a custom profile variable for this user.
This custom variable will be included in this user's personalization profile, and can be used for segmentation, targeting, and reporting purposes. Once registered, the value for this variable can be set using setCustomProfileNumber(String, double) , setCustomProfileNumber(String, float) , or setCustomProfileNumber(String, int) . |
void |
registerCustomProfileNumber(String variableName,
int defaultValue)
Register a custom profile variable for this user.
This custom variable will be included in this user's personalization profile, and can be used for segmentation, targeting, and reporting purposes. Once registered, the value for this variable can be set using setCustomProfileNumber(String, double) , setCustomProfileNumber(String, float) , or setCustomProfileNumber(String, int) . |
void |
registerCustomProfileString(String variableName)
Register a custom profile variable for this user.
This custom variable will be included in this user's personalization profile, and can be used for segmentation, targeting, and reporting purposes. Once registered, the value for this variable can be set using setCustomProfileStringValue(String, String) . |
void |
registerCustomProfileString(String variableName,
String defaultValue)
Register a custom profile variable for this user.
This custom variable will be included in this user's personalization profile, and can be used for segmentation, targeting, and reporting purposes. Once registered, the value for this variable can be set using setCustomProfileStringValue(String, String) . |
void |
registerCustomTuneLinkDomain(String domainSuffix)
If you have set up a custom domain for use with Tune Links (cname to a *.tlnk.io domain), then register it with this method.
|
void |
registerDeepAction(String actionId,
String friendlyName,
Map<String,String> defaultData,
TuneDeepActionCallback action)
Registers a code-block Deep Action for use with TUNE.
|
void |
registerDeeplinkListener(TuneDeeplinkListener listener)
Set the deeplink listener that will be called when either a deferred deeplink is found for a fresh install or for handling an opened Tune Link.
|
void |
registerPowerHook(String hookId,
String friendlyName,
String defaultValue)
Registers a Power Hook for use with TUNE.
|
void |
setAdvertiserId(String advertiserId)
Sets the TUNE advertiser ID.
|
void |
setAge(int age)
Sets the user's age.
|
void |
setAltitude(double altitude)
Sets the device altitude.
|
void |
setAndroidId(String androidId)
Sets the ANDROID ID.
|
void |
setAndroidIdMd5(String androidIdMd5)
Sets the ANDROID ID MD5 hash.
|
void |
setAndroidIdSha1(String androidIdSha1)
Sets the ANDROID ID SHA-1 hash.
|
void |
setAndroidIdSha256(String androidIdSha256)
Sets the ANDROID ID SHA-256 hash.
|
void |
setAppAdTrackingEnabled(boolean adTrackingEnabled)
Sets whether app-level ad tracking is enabled.
|
void |
setConversionKey(String conversionKey)
Sets the conversion key for the SDK.
|
void |
setCurrencyCode(String currencyCode)
Sets the ISO 4217 currency code.
|
void |
setCustomProfileDate(String variableName,
Date value)
Set or update the value associated with a custom date profile variable.
This new value will be used as part of this user's personalization profile, and will be used from this point forward for segmentation, targeting, and reporting purposes. This can be called from anywhere in your app after the appropriate register call in Application.onCreate() . |
void |
setCustomProfileGeolocation(String variableName,
TuneLocation value)
Set or update the value associated with a custom location profile variable.
This new value will be used as part of this user's personalization profile, and will be used from this point forward for segmentation, targeting, and reporting purposes. This can be called from anywhere in your app after the appropriate register call in Application.onCreate() . |
void |
setCustomProfileNumber(String variableName,
double value)
Set or update the value associated with a custom number profile variable.
This new value will be used as part of this user's personalization profile, and will be used from this point forward for segmentation, targeting, and reporting purposes. This can be called from anywhere in your app after the appropriate register call in Application.onCreate() . |
void |
setCustomProfileNumber(String variableName,
float value)
Set or update the value associated with a custom number profile variable.
This new value will be used as part of this user's personalization profile, and will be used from this point forward for segmentation, targeting, and reporting purposes. This can be called from anywhere in your app after the appropriate register call in Application.onCreate() . |
void |
setCustomProfileNumber(String variableName,
int value)
Set or update the value associated with a custom number profile variable.
This new value will be used as part of this user's personalization profile, and will be used from this point forward for segmentation, targeting, and reporting purposes. This can be called from anywhere in your app after the appropriate register call in Application.onCreate() . |
void |
setCustomProfileStringValue(String variableName,
String value)
Set or update the value associated with a custom string profile variable.
This new value will be used as part of this user's personalization profile, and will be used from this point forward for segmentation, targeting, and reporting purposes. This can be called from anywhere in your app after the appropriate register call in Application.onCreate() . |
void |
setDebugMode(boolean debug)
Turns debug mode on or off, under tag "TUNE".
|
void |
setDeeplinkListener(TuneDeeplinkListener listener)
Deprecated.
as of Tune Android SDK v4.8.0 use
registerDeeplinkListener(TuneDeeplinkListener) instead. This method will be removed in Tune Android SDK v5.0.0 |
void |
setDeviceBrand(String deviceBrand)
Sets the device brand, or manufacturer.
|
void |
setDeviceBuild(String deviceBuild)
Sets the device build.
|
void |
setDeviceId(String deviceId)
Sets the device IMEI/MEID.
|
void |
setDeviceModel(String deviceModel)
Sets the device model.
|
void |
setEmailCollection(boolean collectEmail)
Enables or disables primary Gmail address collection
Requires GET_ACCOUNTS permission
|
void |
setExistingUser(boolean existing)
Sets whether app was previously installed prior to version with TUNE SDK.
|
void |
setFacebookEventLogging(boolean logging,
android.content.Context context,
boolean limitEventAndDataUsage)
Whether to log TUNE events in the FB SDK as well
|
void |
setFacebookUserId(String userId)
Sets the user ID to associate with Facebook.
|
void |
setFireAdvertisingId(String adId,
boolean isLATEnabled)
Sets the Amazon Fire Advertising ID.
|
void |
setFullScreenLoadingScreen(int layoutId)
Sets a layout to use as the loading screen before a full screen in-app message is shown, in place of the system default ProgressDialog.
|
void |
setGender(TuneGender gender)
Sets the user gender.
|
void |
setGoogleAdvertisingId(String adId,
boolean isLATEnabled)
Sets the Google Play Services Advertising ID.
|
void |
setGoogleUserId(String userId)
Sets the user ID to associate with Google.
|
void |
setInstallReferrer(String referrer)
Overrides the Google Play INSTALL_REFERRER received
|
void |
setIsPayingUser(boolean isPayingUser)
Sets whether the user is revenue-generating or not.
|
void |
setLatitude(double latitude)
Sets the device latitude.
|
void |
setListener(TuneListener listener)
Register a TuneListener interface to receive server response callback
|
void |
setLocale(String locale)
Sets the device locale
|
void |
setLocation(android.location.Location location)
Sets the device location
|
void |
setLocation(TuneLocation location)
Sets the device location.
|
void |
setLongitude(double longitude)
Sets the device longitude.
|
void |
setMacAddress(String macAddress)
Sets the device MAC address.
|
void |
setOptedOutOfPush(boolean optedOutOfPush)
Specify whether the current user has opted out of push messaging.
This information is added to the personalization profile of the current user for segmentation, targeting, and reporting purposes. |
void |
setOsVersion(String osVersion)
Sets the device OS version
|
void |
setPackageName(String packageName)
Sets the app package name
|
void |
setPhoneNumber(String phoneNumber)
Sets the device phone number
|
void |
setPluginName(String pluginName)
Set the name of plugin used, if any.
|
void |
setPreloadedApp(TunePreloadData preloadData)
Sets publisher information for device preloaded apps
|
void |
setPushListener(TunePushListener listener)
Provide Tune with a push listener to access extraPushPayload and decide if a notification should be displayed.
|
void |
setPushNotificationBuilder(TuneNotificationBuilder builder)
Provide Tune with a notification builder to provide defaults for your app's notifications.
If you do not use setPushNotificationSenderId(String) this doesn't do anything. |
void |
setPushNotificationRegistrationId(String registrationId)
Provide Tune with your GCM registration id for this device.
By using this method you are implicitly enabling Tune Push Messaging. |
void |
setPushNotificationSenderId(String pushSenderId)
Provide Tune with your Push Sender ID.
|
void |
setReferralCallingPackage(String referralCallingPackage)
Set the package that invoked the activity.
|
void |
setReferralSources(android.app.Activity act)
Deprecated.
as of Tune Android SDK v4.8.0 you do not need to call this method directly. This method will be removed in Tune Android SDK v5.0.0
|
void |
setReferralUrl(String url)
Set referral url (deeplink).
|
void |
setShouldAutoCollectDeviceLocation(boolean autoCollect)
Whether to autocollect device location if location is enabled
|
void |
setTRUSTeId(String tpid)
Sets the TRUSTe ID, should generate via their SDK
|
void |
setTwitterUserId(String userId)
Sets the user ID to associate with Twitter
|
protected void |
setUrlRequester(UrlRequester urlRequester)
Set the Url Requester.
|
void |
setUserEmail(String userEmail)
Sets the custom user email.
|
void |
setUserId(String userId)
Sets the custom user ID.
|
void |
setUserName(String userName)
Sets the custom user name.
|
void |
setValueForHookById(String hookId,
String value)
Sets the value of a Power Hook.
|
void |
unregisterDeeplinkListener()
Remove the deeplink listener previously set with
registerDeeplinkListener(TuneDeeplinkListener) . |
protected void |
updateLocation()
If location autocollect is enabled,
tries to get latest location from TuneLocationListener, triggering update if needed
|
protected android.content.BroadcastReceiver networkStateReceiver
protected android.content.Context mContext
protected ExecutorService pubQueue
protected TuneEventQueue eventQueue
protected TuneLocationListener locationListener
protected TuneParameters params
protected TuneTestRequest tuneRequest
protected boolean initialized
protected boolean isRegistered
protected boolean collectLocation
protected boolean isFirstInstall
protected long timeLastMeasuredSession
public static Tune getInstance()
public static Tune init(android.content.Context context, String advertiserId, String conversionKey)
context
- Application contextadvertiserId
- TUNE advertiser IDconversionKey
- TUNE conversion keypublic static Tune init(android.content.Context context, String advertiserId, String conversionKey, boolean turnOnIAM)
context
- Application contextadvertiserId
- TUNE advertiser IDconversionKey
- TUNE conversion keyturnOnIAM
- Whether to enable Tune In-App Marketing or notpublic static Tune init(android.content.Context context, String advertiserId, String conversionKey, boolean turnOnIAM, TuneConfiguration configuration)
context
- Application contextadvertiserId
- TUNE advertiser IDconversionKey
- TUNE conversion keyturnOnIAM
- Whether to enable Tune In-App Marketing or notconfiguration
- custom SDK configurationprotected void initAll(String advertiserId, String conversionKey)
advertiserId
- the TUNE advertiser ID for the appconversionKey
- the TUNE conversion key for the apppublic static boolean isOnline(android.content.Context context)
context
- the app context to check connectivity fromprotected void addEventToQueue(String link, String data, org.json.JSONObject postBody, boolean firstSession)
protected void dumpQueue()
@Deprecated public void measureSession()
measureSessionInternal()
instead. This method will be removed in Tune Android SDK v5.0.0public void measureSessionInternal()
public long getTimeLastMeasuredSession()
public void measureEvent(String eventName)
eventName
- event name in TUNE system@Deprecated public void measureEvent(int eventId)
measureEvent(String)
or measureEvent(TuneEvent)
methods. This method will be removed in Tune Android SDK v5.0.0eventId
- event ID in TUNE systempublic void measureEvent(TuneEvent eventData)
new TuneEvent(eventName)
eventData
- custom data to associate with the eventprotected boolean makeRequest(String link, String data, org.json.JSONObject postBody)
link
- Url addressdata
- Url link datapostBody
- Url post bodyprotected TuneOptional<String> invokeUrlFromReferralUrl(String referralUrl)
protected void updateLocation()
public String getAction()
public String getAdvertiserId()
public int getAge()
setAge(int)
otherwise this method will return 0.public double getAltitude()
setAltitude(double)
otherwise this method will return 0.public String getAndroidId()
setAndroidId(String)
public boolean getAppAdTrackingEnabled()
public String getAppName()
public int getAppVersion()
public String getConnectionType()
public String getCountryCode()
public String getCurrencyCode()
public String getDeviceBrand()
public String getDeviceBuild()
public String getDeviceCarrier()
public String getDeviceId()
public String getDeviceModel()
public boolean getExistingUser()
public String getFacebookUserId()
public String getFireAdvertisingId()
public boolean getFireAdTrackingLimited()
public TuneGender getGender()
setGender(TuneGender)
.public String getGoogleAdvertisingId()
public boolean getGoogleAdTrackingLimited()
public String getGoogleUserId()
public long getInstallDate()
public String getInstallReferrer()
public boolean getIsPayingUser()
public String getLanguage()
public String getLastOpenLogId()
public double getLatitude()
setLatitude(double)
. This value is not automatically retrieved.public String getLocale()
public double getLongitude()
setLongitude(double)
. This value is not automatically retrieved.public String getMacAddress()
public String getMatId()
public String getMCC()
public String getMNC()
public String getOpenLogId()
public String getOsVersion()
public String getPackageName()
public String getPluginName()
public String getReferralSource()
public String getReferralUrl()
public String getScreenDensity()
public String getScreenHeight()
public String getScreenWidth()
public static String getSDKVersion()
public String getTRUSTeId()
public String getTwitterUserId()
public String getUserAgent()
public String getUserEmail()
public String getUserId()
public String getUserName()
public void setAdvertiserId(String advertiserId)
advertiserId
- TUNE advertiser IDpublic void setAge(int age)
age
- User agepublic void setAltitude(double altitude)
altitude
- device altitudepublic void setAndroidId(String androidId)
androidId
- ANDROID_IDpublic void setAndroidIdMd5(String androidIdMd5)
androidIdMd5
- ANDROID_ID MD5 hashpublic void setAndroidIdSha1(String androidIdSha1)
androidIdSha1
- ANDROID_ID SHA-1 hashpublic void setAndroidIdSha256(String androidIdSha256)
androidIdSha256
- ANDROID_ID SHA-256 hashpublic void setAppAdTrackingEnabled(boolean adTrackingEnabled)
adTrackingEnabled
- true if user has opted out of ad tracking at the app-level, false if notpublic void setConversionKey(String conversionKey)
conversionKey
- TUNE conversion keypublic void setCurrencyCode(String currencyCode)
currencyCode
- the currency codepublic void setDeviceBrand(String deviceBrand)
deviceBrand
- device brandpublic void setDeviceBuild(String deviceBuild)
deviceBuild
- device buildpublic void setDeviceId(String deviceId)
deviceId
- device IMEI/MEIDpublic void setDeviceModel(String deviceModel)
deviceModel
- device modelpublic void setExistingUser(boolean existing)
existing
- true if this user already had the app installed prior to updating to TUNE versionpublic void setFacebookUserId(String userId)
userId
- the Facebook user idpublic void setFireAdvertisingId(String adId, boolean isLATEnabled)
adId
- Amazon Fire advertising IDisLATEnabled
- whether user has enabled limit ad trackingpublic void setGender(TuneGender gender)
gender
- use TuneGender.MALE, TuneGender.FEMALEpublic void setGoogleAdvertisingId(String adId, boolean isLATEnabled)
adId
- Google Play advertising IDisLATEnabled
- whether user has enabled limit ad trackingpublic void setGoogleUserId(String userId)
userId
- the Google user idpublic void setInstallReferrer(String referrer)
referrer
- Your custom referrer valuepublic void setIsPayingUser(boolean isPayingUser)
isPayingUser
- true if the user has produced revenue, false if notpublic void setLocale(String locale)
locale
- the device localepublic void setLocation(android.location.Location location)
location
- the device locationpublic void setLocation(TuneLocation location)
location
- the device location as a TuneLocationpublic void setLatitude(double latitude)
latitude
- the device latitudepublic void setLongitude(double longitude)
longitude
- the device longitudepublic void setListener(TuneListener listener)
listener
- a TuneListener object that will be called when server request is completepublic void setMacAddress(String macAddress)
macAddress
- device MAC addresspublic void setOsVersion(String osVersion)
osVersion
- device OS versionpublic void setPackageName(String packageName)
packageName
- App package namepublic void setPhoneNumber(String phoneNumber)
phoneNumber
- Phone numberpublic void setPreloadedApp(TunePreloadData preloadData)
preloadData
- Preload app attribution data@Deprecated public void setReferralSources(android.app.Activity act)
act
- Activity to get referring package name and url scheme frompublic void setReferralCallingPackage(@Nullable String referralCallingPackage)
Activity.getCallingPackage()
and may be null.referralCallingPackage
- The name of the callling packagepublic void setReferralUrl(String url)
measureSessionInternal()
or measureSession()
url
- deeplink with which app was invokedpublic void setTRUSTeId(String tpid)
tpid
- TRUSTe IDpublic void setTwitterUserId(String userId)
userId
- the Twitter user idpublic void setUserEmail(String userEmail)
userEmail
- the user emailpublic void setUserId(String userId)
userId
- the user idpublic void setUserName(String userName)
userName
- the usernamepublic void setPluginName(String pluginName)
pluginName
- the name of the plugin usedpublic void setDebugMode(boolean debug)
debug
- whether to enable debug outputpublic boolean isInDebugMode()
public void setEmailCollection(boolean collectEmail)
collectEmail
- whether to collect device email addresspublic void setFacebookEventLogging(boolean logging, android.content.Context context, boolean limitEventAndDataUsage)
logging
- Whether to send TUNE events to FB as wellcontext
- Activity contextlimitEventAndDataUsage
- Whether user opted out of ads targetingpublic void setShouldAutoCollectDeviceLocation(boolean autoCollect)
autoCollect
- Automatically collect device location, default is truepublic void registerPowerHook(String hookId, String friendlyName, String defaultValue)
Application.onCreate()
.hookId
- The name of the configuration setting to register. Name must be unique for this app and cannot be empty.friendlyName
- The name for this hook that will be displayed in TMC. This value cannot be empty.defaultValue
- The default value for this hook. This value will be used if no value is passed in from TMC for this app. This value cannot be nil.public String getValueForHookById(String hookId)
hookId
- The name of the Power Hook you wish to retrieve. Will return nil if the Power Hook has not been registered.public void setValueForHookById(String hookId, String value)
hookId
- The name of the Power Hook you wish to set the value for.value
- The new value you would like to test.public void onPowerHooksChanged(TuneCallback callback)
callback
- The block of code to be executed.public void registerDeepAction(String actionId, String friendlyName, Map<String,String> defaultData, TuneDeepActionCallback action)
actionId
- The name of the deep action to register. Name must be unique for this app and cannot be null or empty.friendlyName
- The friendly name for this action that will be displayed in TMC. This value cannot be null.defaultData
- The default values for this deep action. These values will be used if no value is passed in from TMC for this app. This cannot be null.action
- The code block that implements Runnable to execute when this Deep Action fires. This cannot be nullpublic void executeDeepAction(android.app.Activity activity, String actionId, Map<String,String> data)
activity
- Activity object to be made available to the deep action code-block. This object may be null depending on its usage in the code-block.actionId
- Non-empty non-null name of a previously registered deep action code-block.data
- Values to be used with the deep action. This Map may be null or empty or contain string keys and values.public Map<String,TunePowerHookExperimentDetails> getPowerHookExperimentDetails()
public Map<String,TuneInAppMessageExperimentDetails> getInAppMessageExperimentDetails()
public void onFirstPlaylistDownloaded(TuneCallback callback)
TuneConstants.DEFAULT_FIRST_PLAYLIST_DOWNLOADED_TIMEOUT
milliseconds or when the first playlist is downloaded, whichever comes first.
NOTE: This callback will fire upon first playlist download from the application start and upon each callback registration call.
If registered more than once, the latest callback will always fire, regardless of whether a previously registered callback already executed.
We do not recommend registering more than once but if you do so, please make sure that executing the callback more than once will not cause any issues in your app.
NOTE: Only one callback can be registered at a time. Each time a callback is registered it will fire.
NOTE: Pending callbacks will be canceled upon app background and resumed upon app foreground.
WARNING: If TMA is not enabled then this callback will never fire.callback
- A TuneCallback object that is to be executed.public void onFirstPlaylistDownloaded(TuneCallback callback, long timeout)
callback
- A TuneCallback object that is to be executed.timeout
- The number of miliseconds to wait until executing the callback regardless
of Playlist download.public List<TuneInAppMessage> getInAppMessagesForCustomEvent(String eventName)
eventName
- Event name of custom TuneEvent
that would trigger these messagespublic List<TuneInAppMessage> getInAppMessagesForPushOpened(String pushId)
pushId
- Push id (message variation id) of the push notification.public List<TuneInAppMessage> getInAppMessagesForPushEnabled(boolean pushEnabled)
setOptedOutOfPush(boolean)
or the user profile's age does not meet COPPA (automatically disabled)pushEnabled
- Whether Push Enabled or Push Disabled is the event to usepublic List<TuneInAppMessage> getInAppMessagesForStartsApp()
public List<TuneInAppMessage> getInAppMessagesForScreenViewed(String activityName)
activityName
- Activity name for the Viewed Screen eventpublic Map<String,TuneInAppMessage> getInAppMessagesByIds()
TuneInAppMessage
objects.public Map<String,List<TuneInAppMessage>> getInAppMessagesByTriggerEvents()
TuneInAppMessage
objects with that trigger.public void preloadMessages(android.app.Activity activity)
activity
- Activity where messages would be shown when triggeredpublic void preloadMessagesForCustomEvent(android.app.Activity activity, String eventName)
activity
- Activity where messages would be shown when triggeredeventName
- Trigger event name for the messagespublic void preloadMessageWithId(android.app.Activity activity, String messageId)
activity
- Activity where message would be shown when triggeredmessageId
- Message IDpublic void setFullScreenLoadingScreen(int layoutId)
layoutId
- layout id of the custom load screen to usepublic void setPushNotificationSenderId(String pushSenderId)
setPushNotificationRegistrationId(String)
pushSenderId
- Your Push Sender Id.public void setPushNotificationRegistrationId(String registrationId)
setPushNotificationSenderId(String)
registrationId
- The device token you want to use.public void setPushNotificationBuilder(TuneNotificationBuilder builder)
setPushNotificationSenderId(String)
this doesn't do anything.
Important: If you do not provide a small icon for your notifications via the builder we will default to using your app icon. This may look odd if your app is targeting API 21+ because the OS will take only the alpha of the icon and display that on a neutral background. If your app is set to target API 21+ we strongly recommend that you take advantage of the TuneNotificationBuilder
API.builder
- by providing a TuneNotificationBuilder
you can provide defaults for your app's notifications for Tune Push Messages, like the small iconpublic void setPushListener(TunePushListener listener)
listener
- by providing a TunePushListener
you can access the extraPushPayload and decide if the notification should be displayedpublic void setOptedOutOfPush(boolean optedOutOfPush)
optedOutOfPush
- Whether the user opted out of push messaging.public String getDeviceToken()
public boolean didUserManuallyDisablePush()
public boolean didSessionStartFromTunePush()
TuneActivity
manually then this should be called after `super.onStart();` in the activity.public TunePushInfo getTunePushInfoForSession()
TuneActivity
manually then this should be called after `super.onStart();` in the activity.didSessionStartFromTunePush()
is true, otherwise null.public boolean isUserInSegmentId(String segmentId)
segmentId
- Segment ID to check for a matchpublic boolean isUserInAnySegmentIds(List<String> segmentIds)
segmentIds
- Segment IDs to check for a match@Deprecated public void checkForDeferredDeeplink(TuneDeeplinkListener listener)
TuneDeeplinkListener
via registerDeeplinkListener(TuneDeeplinkListener)
. As of Tune Android SDK v4.8.0 this method delegates to registerDeeplinkListener(TuneDeeplinkListener)
so that there is only ever one listener at a time. This method is planned for removal in Tune Android SDK v5.0.0.TuneDeeplinkListener
listener
- listener for deeplink value or error@Deprecated public void setDeeplinkListener(TuneDeeplinkListener listener)
registerDeeplinkListener(TuneDeeplinkListener)
instead. This method will be removed in Tune Android SDK v5.0.0listener
- will be called with deferred deeplinks after install or expanded Tune links.public void unregisterDeeplinkListener()
registerDeeplinkListener(TuneDeeplinkListener)
.public void registerDeeplinkListener(@Nullable TuneDeeplinkListener listener)
TuneDeeplinkListener#didFailWithError
callback will be called if there is no deferred deeplink from Tune for this user or in the event of an error from the server (possibly due to misconfiguration).
The TuneDeeplinkListener#didReceiveDeeplink
callback will be called when there is a deep link from Tune that you should route the user to. The string should be a fully qualified deep link url string.listener
- will be called with deferred deeplinks after install or expanded Tune links. May be null. Passing null will clear the previously set listener, although you may use unregisterDeeplinkListener()
instead.public void registerCustomTuneLinkDomain(@NonNull String domainSuffix)
TuneDeeplinkListener.didReceiveDeeplink(String)
registered via registerDeeplinkListener(TuneDeeplinkListener)
This method will test if any clicked links match the given suffix. Do not include a * for wildcard subdomains, instead pass the suffix that you would like to match against the url.
So, ".customize.it" will match "1235.customize.it" and "56789.customize.it" but not "customize.it"
And, "customize.it" will match "1235.customize.it" and "56789.customize.it", "customize.it", and "1235.tocustomize.it"
You can register as many custom subdomains as you like.domainSuffix
- domain which you are using for Tune Links. Must not be null.public boolean isTuneLink(@NonNull String appLinkUrl)
TuneDeeplinkListener.didReceiveDeeplink(String)
registered via registerDeeplinkListener(TuneDeeplinkListener)
appLinkUrl
- url to test if it is a Tune Link. Must not be null.TuneDeeplinkListener
.protected void setUrlRequester(UrlRequester urlRequester)
urlRequester
- UrlRequesterpublic void registerCustomProfileString(String variableName)
setCustomProfileStringValue(String, String)
. The default value is nil. Application.onCreate()
method.variableName
- Name of the variable to register for the current user. Valid characters for this name include [0-9],[a-z],[A-Z], -, and _. Any other characters will automatically be stripped out.public void registerCustomProfileDate(String variableName)
setCustomProfileDate(String, Date)
. The default value is nil. Application.onCreate()
method.variableName
- Name of the variable to register for the current user. Valid characters for this name include [0-9],[a-z],[A-Z], -, and _. Any other characters will automatically be stripped out.public void registerCustomProfileNumber(String variableName)
setCustomProfileNumber(String, double)
, setCustomProfileNumber(String, float)
, or setCustomProfileNumber(String, int)
.
You may use these setters interchangeably. The default value is nil.
Application.onCreate()
method.variableName
- Name of the variable to register for the current user. Valid characters for this name include [0-9],[a-z],[A-Z], -, and _. Any other characters will automatically be stripped out.public void registerCustomProfileGeolocation(String variableName)
setCustomProfileGeolocation(String, TuneLocation)
. The default value is nil. Application.onCreate()
method.variableName
- Name of the variable to register for the current user. Valid characters for this name include [0-9],[a-z],[A-Z], -, and _. Any other characters will automatically be stripped out.public void registerCustomProfileString(String variableName, String defaultValue)
setCustomProfileStringValue(String, String)
. The default value is nil. Application.onCreate()
method.variableName
- Name of the variable to register for the current user. Valid characters for this name include [0-9],[a-z],[A-Z], -, and _. Any other characters will automatically be stripped out.defaultValue
- Initial value for the variable.public void registerCustomProfileDate(String variableName, Date defaultValue)
setCustomProfileDate(String, Date)
. The default value is nil. Application.onCreate()
method.variableName
- Name of the variable to register for the current user. Valid characters for this name include [0-9],[a-z],[A-Z], -, and _. Any other characters will automatically be stripped out.defaultValue
- Initial value for the variable.public void registerCustomProfileNumber(String variableName, int defaultValue)
setCustomProfileNumber(String, double)
, setCustomProfileNumber(String, float)
, or setCustomProfileNumber(String, int)
.
You may use these setters interchangeably. The default value is nil.
Application.onCreate()
method.variableName
- Name of the variable to register for the current user. Valid characters for this name include [0-9],[a-z],[A-Z], -, and _. Any other characters will automatically be stripped out.defaultValue
- Initial value for the variable.public void registerCustomProfileNumber(String variableName, double defaultValue)
setCustomProfileNumber(String, double)
, setCustomProfileNumber(String, float)
, or setCustomProfileNumber(String, int)
.
You may use these setters interchangeably. The default value is nil.
Application.onCreate()
method.variableName
- Name of the variable to register for the current user. Valid characters for this name include [0-9],[a-z],[A-Z], -, and _. Any other characters will automatically be stripped out.defaultValue
- Initial value for the variable.public void registerCustomProfileNumber(String variableName, float defaultValue)
setCustomProfileNumber(String, double)
, setCustomProfileNumber(String, float)
, or setCustomProfileNumber(String, int)
.
You may use these setters interchangeably. The default value is nil.
Application.onCreate()
method.variableName
- Name of the variable to register for the current user. Valid characters for this name include [0-9],[a-z],[A-Z], -, and _. Any other characters will automatically be stripped out.defaultValue
- Initial value for the variable.public void registerCustomProfileGeolocation(String variableName, TuneLocation defaultValue)
setCustomProfileGeolocation(String, TuneLocation)
. The default value is nil. Application.onCreate()
method.variableName
- Name of the variable to register for the current user. Valid characters for this name include [0-9],[a-z],[A-Z], -, and _. Any other characters will automatically be stripped out.defaultValue
- Initial value for the variable.public void setCustomProfileStringValue(String variableName, String value)
Application.onCreate()
. value
- Value to use for the given variable.variableName
- Variable to which this value should be assigned.public void setCustomProfileDate(String variableName, Date value)
Application.onCreate()
. value
- Value to use for the given variable.variableName
- Variable to which this value should be assigned.public void setCustomProfileNumber(String variableName, int value)
Application.onCreate()
. value
- Value to use for the given variable.variableName
- Variable to which this value should be assigned.public void setCustomProfileNumber(String variableName, double value)
Application.onCreate()
. value
- Value to use for the given variable.variableName
- Variable to which this value should be assigned.public void setCustomProfileNumber(String variableName, float value)
Application.onCreate()
. value
- Value to use for the given variable.variableName
- Variable to which this value should be assigned.public void setCustomProfileGeolocation(String variableName, TuneLocation value)
Application.onCreate()
. value
- Value to use for the given variable.variableName
- Variable to which this value should be assigned.public String getCustomProfileString(String variableName)
Application.onCreate()
.
variableName
- Name of the custom profile variable.public Date getCustomProfileDate(String variableName)
Application.onCreate()
.
variableName
- Name of the custom profile variable.public Number getCustomProfileNumber(String variableName)
Application.onCreate()
.
variableName
- Name of the custom profile variable.public TuneLocation getCustomProfileGeolocation(String variableName)
Application.onCreate()
.
variableName
- Name of the custom profile variable.public String getAppId()
public void clearCustomProfileVariable(String variableName)
Application.onCreate()
.variableName
- Name of the custom profile variable to clear.public void clearAllCustomProfileVariables()
Application.onCreate()
.public final TuneParameters getTuneParams()
TuneParameters
used to initialize Tune.public void enableSmartwhere() throws TuneConfigurationException
TuneConfigurationException
- if Smartwhere is not available.public void disableSmartwhere() throws TuneConfigurationException
TuneConfigurationException
- if Smartwhere is not available.public void configureSmartwhere(TuneSmartwhereConfiguration config) throws TuneConfigurationException
config
- TuneSmartwhereConfiguration
ConfigurationTuneConfigurationException
- if Smartwhere is not available.