Location Tracking

You can track user's location or set it yourself by following the below steps. This data will allow you to create a geo-location-based target audience.

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)
SmartechSDK.setUserLocation(LATITUDE_DOUBLE_VALUE,  LONGITUDE_DOUBLE_VALUE);

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