Location Tracking

Netcore CE SDK automatically tracks the location of the user unless you have set NO as the value for the key SmartechAutoFetchLocation in your apps Info.plist under SmartechKeys dictionary.

If the application is already tracking the location and you would want Netcore CE to use that value, then register the location with the SDK by calling setUserLocation.

CLLocationCoordinate2D location = CLLocationCoordinate2DMake(latitude, longitude);
[[Smartech sharedInstance] setUserLocation:location];
let location = CLLocationCoordinate2DMake(latitude, longitude)
Smartech.sharedInstance().setUserLocation(location)
SmartechSDK.setUserLocation(LATITUDE_DOUBLE_VALUE,  LONGITUDE_DOUBLE_VALUE);

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

The location collected, either explicitly or implicitly, will be sent to Netcore CE servers with every Netcore CE SDK event. We will continue to send the same location value to our server until it changes.

This location value is maintained in memory and flushed on every app launch. If the app is setting the location value manually, it's recommended that the new value be set as soon as the app is launched. If the value is not set, Netcore CE SDK will send the blank value to the Netcore CE server.

If SmartechAutoFetchLocation is YES, the value will be automatically updated on app launch.

📘

Key Points to Note

If you're using Location Tracking for Geofencing, please note the below points:

  • Geofence functionality is supported from Android SDK v3.1.11 and iOS SDK v3.1.3 onwards. Ensure to integrate location tracking steps for Android and iOS.
  • Implement location permission on the app side to get both foreground and background location permission.
  • If your app includes the location permissions in the manifest when uploading the APK to the Play Console, you must inform Google why your app needs them.
    Google requires clear justification for using these permissions. If the reason is not valid, your app may be rejected.
  • This feature is available for Native, React Native, and Flutter platforms.
  • Event tracking is available only for Android SDK.


Did this page help you?