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

Location Tracking

Smartech SDK allows the user to track location using setUserLocation() method which takes context, Latitude and Longitude as parameters and datatype of both should be double. You can use this location in journeys.

Location location = new Location("");
location.setLongitude(19.185664);
location.setLongitude(72.9808896);
Smartech.getInstance(new WeakReference<Context>(context)).setUserLocation(location);
val location = Location("")
location.longitude = 19.185664
location.longitude = 72.9808896
Smartech.getInstance(WeakReference(context)).setUserLocation(location)

GDPR Compliance

Smartech believes privacy is a fundamental human right, which is why Smartech SDK has optOut() method, once called will stop tracking user's events, displaying of In-App Messages and receiving push notifications sent from the Smartech panel.

Opt-Out From Tracking

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

Smartech.getInstance(new WeakReference<Context>(context)).optOut(true);
Smartech.getInstance(WeakReference(context)).optOut(true)

Opt-In For Tracking

To opt-in for tracking, call the optOut() method by passing false value.

Smartech.getInstance(new WeakReference<Context>(context)).optOut(false);
Smartech.getInstance(WeakReference(context)).optOut(false)

Opt-out Status

To get status of opt-out for tracking, call the getOptOutStatus() method.

boolean isOptedOut=Smartech.getInstance(new WeakReference<Context>(context)).getOptOutStatus();
val isOptedOut:Boolean=Smartech.getInstance(WeakReference(context)).getOptOutStatus()

Get GUID/Device Unique Id

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

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

Implementing Deeplink In The Application

To implement deeplink in the application, add given snippet inside AndroidManifest.xml file within the Activity Tag.

<intent-filter>
	<action android:name = "android.intent.action.VIEW"/>
	<category android:name = "android.intent.category.DEFAULT"/>
	<category android:name = "android.intent.category.BROWSABLE"/>
	<data android:scheme = "<scheme>" android:host= "<host>"/>
</intent-filter>

// Sample code for reference purpose only
// This will create the deeplink as smartech://products
<intent-filter>
	<action android:name= "android.intent.action.VIEW"/>
	<category android:name= "android.intent.category.DEFAULT"/>
	<category android:name= "android.intent.category.BROWSABLE"/>
	<data android:scheme = "smartech" android:host= "products"/>
</intent-filter>

Set In-App HTML Listener

Setting the In-App HTML listener

To set In-App HTML listener implement the following snippet in the Application class of your project.

public class SmartechApplication extends Application implements InAppCustomHTMLListener {

   @Override
   public void onCreate() {
       super.onCreate();
       ...
       Smartech.getInstance(new WeakReference<Context>(context)).setInAppCustomHTMLListener(this);
   }

   @Override
    public void customHTMLCallback(Map<String, Object> map) {
        //TODO(Developer) Handle the callback.
    }
}
class SmartechApplication : Application(), InAppCustomHTMLListener {
   override fun onCreate() {
       super.onCreate();
       ...
       Smartech.getInstance(WeakReference(context)).setInAppCustomHTMLListener(this);
   }

   override fun customHTMLCallback(map: Map<String?, Any?>) {
        //TODO(Developer) Handle the callback.
    }
}

Getting the In-App HTML listener

If you want to get the In-App HTML listener use the following snippet.

WeakReference<InAppCustomHTMLListener> listener=Smartech.getInstance(new WeakReference<Context>(context)).getInAppCustomHTMLListener();
val listener: WeakReference<InAppCustomHTMLListener>?=Smartech.getInstance(WeakReference(context)).getInAppCustomHTMLListener()