The developer should initialize the “Tracker” class in the Application class and pass the App Key, Workspace ID along with a couple of other parameters as below. The Tracker class provides a versatile implementation allowing developers a number of configuration options. During the init method call, the user’s session will be automatically created inside the SDK.
Method
public static Tracker init(@NonNull Context context, boolean addGeo, String appKey, String workspaceId)
public static Tracker init(@NonNull Context context, boolean addGeo, String appKey, String workspaceId, int sendBatch)
public static Tracker init(@NonNull Context context, boolean addGeo, String appKey, String workspaceId, int sendBatch, int waitResponse)
Parameters
context - Application context
addGeo - Flag used to decide whether to append the geo parameter(latitude and longitude) in the Payloads or Not.
appKey - Generated from the Datagran dashboard
workspaceId - Generated from the Datagran dashboard
sendBatch - To send the events to the backend batch wise as per the specified interval. By default, it is 60seconds.
waitResponse - To set the API connection timeout. By default, it is 3 seconds.
Example
Tracker.*init*(**this**, **true**, getString(R.string.***datagran_app_key***), getString(R.string.***datagran_workspace_id***));
Tracker.*init*(**this**, **true**, getString(R.string.***datagran_app_key***), getString(R.string.***datagran_workspace_id***), 10);
Tracker.init(**this**, **true**, getString(R.string.***datagran_app_key***), getString(R.string.***datagran_workspace_id***), 10, 60);