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. This location is saved as 'last known location' attribute of the user and can be used for segmentation and journeys.

NetcoreSDK.setUserLocation(context, LATITUDE_DOUBLE_VALUE,  LONGITUDE_DOUBLE_VALUE);

// Sample code for reference purpose only
NetcoreSDK.setUserLocation(context, 19.0760, 72.8777);

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.

NetcoreSDK.optOut(context, true);

Opt-In For Tracking

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

NetcoreSDK.optOut(context, false);

Get GUID

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

String guid = NetcoreSDK.getGUID(context);

Get Token

To get the Token which is generated by FCM, you can call the getPushToken() method.

String token = NetcoreSDK.getPushToken(context);

To Fetch Advertising Id

If you want to fetch Advertising Id of the device using Smartech SDK, follow the steps below.

Adding Dependency

implementation 'com.google.android.gms:play-services-ads:17.2.1'

Adding Meta tags

<meta-data
	android:name="com.google.android.gms.ads.APPLICATION_ID"
	android:value="YOUR_ADMOB_APP_ID"/>
    
<meta-data
	android:name="SMT_USE_AD_ID"
	android:value="1_OR_0_VALUE"/>

📘

NOTE:

  • To get "AdMob App ID" please refer this Google documentation: https://developers.google.com/admob/android/quick-start
  • This tag accepts either ‘0’ or ‘1’ as value. If an app wants Smartech SDK to fetch Advertising Id of the device, use ‘1’ as value otherwise use '0'.

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>