-
public final class Batch.UserBatch User module
-
-
Method Summary
Modifier and Type Method Description static StringgetInstallationID()Get the unique installation ID, generated by Batch. static StringgetLanguage(@NonNull() Context context)Read the language. static StringgetRegion(@NonNull() Context context)Read the region. static StringgetIdentifier(@NonNull() Context context)Read the custom identifier. static BatchUserDataEditorgetEditor()Get the user data editor. static BatchUserDataEditoreditor()Get the user data editor. static voidfetchAttributes(@NonNull() Context context, @Nullable() BatchAttributesFetchListener listener)Read the saved attributes. static voidfetchTagCollections(@NonNull() Context context, @Nullable() BatchTagCollectionsFetchListener listener)Read the saved tag collections. static voidtrackEvent(@NonNull() String event)Track an event.You can call this method from any thread. static voidtrackEvent(@NonNull() String event, String label)Track an event.You can call this method from any thread. static voidtrackEvent(@NonNull() String event, String label, JSONObject data)Track an event.You can call this method from any thread. static voidtrackEvent(@NonNull() String event, String label, BatchEventData data)Track an event.You can call this method from any thread. static voidtrackLocation(@NonNull() Location location)Track a location update.You can call this method from any thread. static voidtrackTransaction(double amount)Track a transaction.You can call this method from any thread. static voidtrackTransaction(double amount, JSONObject data)Track a transaction.You can call this method from any thread. static voidprintDebugInformation()Print the currently known attributes and tags for a user to logcat. -
-
Method Detail
-
getInstallationID
@Nullable() static String getInstallationID()
Get the unique installation ID, generated by Batch. Batch must be started to read it.
-
getLanguage
@Nullable() static String getLanguage(@NonNull() Context context)
Read the language.
-
getIdentifier
@Nullable() static String getIdentifier(@NonNull() Context context)
Read the custom identifier.
-
getEditor
@Deprecated() static BatchUserDataEditor getEditor()
Get the user data editor. Batch must be started to save it.
-
editor
static BatchUserDataEditor editor()
Get the user data editor. Batch must be started to save it.Note that you should chain calls to the returned editor.If you call this method again, you will get another editor that's not aware of changes made elsewhere that have not been saved.
-
fetchAttributes
static void fetchAttributes(@NonNull() Context context, @Nullable() BatchAttributesFetchListener listener)
Read the saved attributes. Reading is asynchronous so as not to interfere with saving operations.
- Parameters:
listener- Pass a listener to be notified of the fetch result.
-
fetchTagCollections
static void fetchTagCollections(@NonNull() Context context, @Nullable() BatchTagCollectionsFetchListener listener)
Read the saved tag collections. Reading is asynchronous so as not to interfere with saving operations.
- Parameters:
listener- Pass a listener to be notified of the fetch result.
-
trackEvent
static void trackEvent(@NonNull() String event)
Track an event.You can call this method from any thread. Batch must be started at some point, or events won't be sent to the server.
- Parameters:
event- The event name.
-
trackEvent
static void trackEvent(@NonNull() String event, String label)
Track an event.You can call this method from any thread. Batch must be started at some point, or events won't be sent to the server.
- Parameters:
event- The event name.label- The event label.
-
trackEvent
@Deprecated() static void trackEvent(@NonNull() String event, String label, JSONObject data)
Track an event.You can call this method from any thread. Batch must be started at some point, or events won't be sent to the server.
- Parameters:
event- The event name.label- The event label.data- The event data.
-
trackEvent
static void trackEvent(@NonNull() String event, String label, BatchEventData data)
Track an event.You can call this method from any thread. Batch must be started at some point, or events won't be sent to the server.
- Parameters:
event- The event name.label- The event label.data- The event data.
-
trackLocation
static void trackLocation(@NonNull() Location location)
Track a location update.You can call this method from any thread. Batch must be started at some point, or location updates won't be sent to the server.The location object usually comes from the location system service, or the Fused Location API, but can also manually create it.If you manually create it, please make sure to fill the accuracy and date if you have that data: both of these values are usedto improve the targeting.
- Parameters:
location- The location.
-
trackTransaction
static void trackTransaction(double amount)
Track a transaction.You can call this method from any thread. Batch must be started at some point, or events won't be sent to the server.
- Parameters:
amount- Transaction amount.
-
trackTransaction
static void trackTransaction(double amount, JSONObject data)
Track a transaction.You can call this method from any thread. Batch must be started at some point, or events won't be sent to the server.
- Parameters:
amount- Transaction amount.data- Transaction data.
-
printDebugInformation
static void printDebugInformation()
Print the currently known attributes and tags for a user to logcat.
For debug purposes only. Don't rely on the log format, because it can change at any time without warning.
-
-
-
-