These docs are for v1.0. Click to read the latest docs for v2.0.

Location Tracking

If you have set the SMT_IS_AUTO_FETCHED_LOCATION in meta-data tag inside the AndroidManifest file with value 1 then SDK will fetch location for events only if the application has location permission.

<meta-data
     android:name="SMT_IS_AUTO_FETCHED_LOCATION"
     android:value="1" />

If you want to manually set the location, you can use setUserLocation() method which takes the Location class object as a parameter. The location will only be the same until and unless this method gets the new location, if the location is not updated then for every event the same location will be sent and it will only reset after the app launch.

Smartech.getInstance(new WeakReference<>(context)).setUserLocation(location);
Smartech.getInstance(WeakReference(context)).setUserLocation(location)

Process Events Manually

If you want to sync all the events which are tracked by Smartech SDK and are in the database when the user was offline then you call processEventsManually method which will start the sync of all stored methods from database which were stored when the user was offline.

Smartech.getInstance(new WeakReference<>(context)).processEventsManually();
Smartech.getInstance(WeakReference(context)).processEventsManually()

Opt Tracking

To opt-out of tracking call the optTracking() method by passing false value. Once you have opted out of tracking you need to explicitly opt-in, until opted in no communication will happen with the panel. To opt-in for tracking, call the optTracking() method by passing true value.

Smartech.getInstance(new WeakReference<>(context)).optTracking(booleanOpt);
Smartech.getInstance(WeakReference(context)).optTracking(booleanOpt)

Opt Push Notifications

Smartech SDK has optPushNotification() method to opt-in or opt-out for Push Notifications sent from the panel.
Passing false in the parameter will opt-out for Push Notifications. For opt-in pass true in the parameter.

Smartech.getInstance(new WeakReference<>(context)).optPushNotification(booleanOpt);
Smartech.getInstance(WeakReference(context)).optPushNotification(booleanOpt)

Opt In-App Messages

To opt-in or opt-out In-App messages sent from the panel, SDK provides optInAppMessage() method. Passing false in the parameter will opt-out for In-App messages. To opt-in again pass true in the parameter.

Smartech.getInstance(new WeakReference<>(context)).optInAppMessage(booleanOpt);
Smartech.getInstance(WeakReference(context)).optInAppMessage(booleanOpt)

Get GUID

To get the GUID which is used by Smartech SDK to identify the user, you can call the getGUID() method.

String guid = Smartech.getInstance(new WeakReference<>(context)).getDeviceUniqueId();
val guid=Smartech.getInstance(WeakReference(context)).getDeviceUniqueId()