public class MixpanelHandler extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
addDefaultProperty(String propertyName,
String propertyValue)
Properties that are added with this method will be appended to all future messages that are sent to Mixpanel.
|
static boolean |
addMessage(String eventName,
Map<String,String> properties)
Add a new message to the Mixpanel delivery queue.
|
static boolean |
sendMessages()
Send all collected messages to Mixpanel.
|
static void |
setProject(String mixpanelProjectToken)
Set the project-token that can be obtained from Mixpanel.
|
static void |
setUniqueID(String distinctMixpanelID)
Set a distinct ID for all Mixpanel messages sent from this application-instance.
|
static boolean |
startAutoUploader(long messageDelayMillis)
Start a background
Thread
that will send all messages in the queue every x seconds. |
static boolean |
stopAutoUploader(boolean force)
Interrupt the background
Thread that sends messages automatically. |
public static boolean startAutoUploader(long messageDelayMillis)
Thread
that will send all messages in the queue every x seconds.messageDelayMillis - The delay in milliseconds between each send-operation.
Using a longer delay will make the Thread less responsive when stopping it again.
The delay can't be set below 1000. Smaller delays will increase network-load.Thread was started successfully, False if the Thread was already running.public static boolean stopAutoUploader(@Deprecated boolean force)
Thread that sends messages automatically.public static boolean sendMessages()
public static boolean addMessage(String eventName, Map<String,String> properties)
eventName - The name of the event. This will also be visible on Mixpanel.
This must not be null.properties - The properties for this message.
These will be visible and filterable on Mixpanel.public static boolean addDefaultProperty(String propertyName, String propertyValue)
propertyName - The name of the property that will be visible on Mixpanel.propertyValue - The value of the property.public static void setProject(String mixpanelProjectToken)
mixpanelProjectToken - The token of you Mixpanel project.public static void setUniqueID(String distinctMixpanelID)
distinctMixpanelID - The distinctID that is added to each Mixpanel message.Copyright © 2022. All rights reserved.