Android SDK
1. Adding Anecdote to your project
Include jitpack in your root
settings.gradle
file.
And add it's dependency to your app level
build.gradle
file.
2. Initialize
In your Application
class add this line to your onCreate
method.
3. Set User Parameters
Add the following lines to set the user id and custom parameters.
Note: User id is a unique identifier for the user, and mandatory to set. And custom parameters are additional information about the user that can be used for targeting the survey.
4. Trigger Event
To trigger an event, add the following line.
Events can be triggered as needed, for example, when a user clicks a button or logs in. Event can be triggered from any part of the app, such as an Activity, ViewModel, etc.
5. Dispose
If needed to cancel already triggered events that are still being processed, add the following line.
For example, if events were triggered on a screen but the survey hasn’t been shown yet, and the screen is closed without needing to show the survey anymore, the dispose method can be called to cancel the processing of the triggered events.
6. Terminate
To disable the SDK add the following line.
Once terminated, all SDK processing will stop, and further calls (like triggerEvent
) will not have any effect. For example, terminate method can be called when the user logs out of the app.
Last updated