LOCATION SDK INTEGRATION GUIDE


In this detailed guide, we take you through the steps required to integrate the library with your Android and iOS app.

GETTING THE INTEGRATION KEY
 
STEP 1 - After a legal contract has been signed between the Publisher and Quadrant, an invitation will be sent to Publisher’s email redirecting to register to the platform.
 
1
 
STEP 2 - Register on the Quadrant Publisher Platform
2-Jul-01-2021-06-22-46-69-AM
 
STEP 3 - Once you're logged in, click PUBLISHER DASHBOARD from the menu on the left. This will display your publisher dashboard.
 
3-Jul-01-2021-06-25-30-83-AM
 
STEP 4 - Add your App, and choose 'Location' as SDK type, select your desired OS Type and submit.
 
4-4
 
STEP 5 - Once submitted, your app will be enlisted, but the Integration key will not be displayed yet. At this point, you require an admin's approval. The admin will be automatically notified and can take the needful action.
 
5
 
STEP 6 - Once approved, your integration key will be displayed on the dashboard. You need to distribute this integration key to your app developers.
 
6
 

INTEGRATING THE SDK - ANDROID

Latest version: 1.0.9

STEP 1 - In Android Studio, open setting.gradle or build.gradle (at project level), and add the “maven” line: 


STEP 2 -
Open build.gradle (at the app level), and add this under 'dependencies' code section:
 
 
STEP 3 - Still at the build.gradle (at the app level), add this under android → defaultConfig code section:

STEP 4 - Example code for SDK setup (best to put it at application class):

JAVA 

KOTLIN 

STEP 5 - Example code to start tracking location:

JAVA 

KOTLIN

 
STEP 6 - When you release an app and use minifyEnabled true, add this to your proguard rules file:
 
-keep class com.quadrant.sdk.locationdata.** {*;}
 
Click here for a reference on Github
 
and that's it!
 

SETTING UP A PERIODIC CALLBACK 

Before proceeding to this section, make sure that the Location SDK has been integrated successfully (details are available at Quadrant | SDK Integration).

Quadrant’s Location SDK has a callback that goes by the name GeneralCallBack (path: com.quadrant.sdk.locationdata.retrofit). The callback has two functions:

  1. void onSuccess(String)
  2. void onError(String)


The names of the functions represent their purpose. If you have followed our guide (
INTEGRATING THE SDK – ANDROID), you might remember “STEP 5 – Example code to start tracking location” which explains how to invoke location tracking by using the parameters within the GeneralCallBack.
For example, we can use the following location invocation function in Kotlin:

 

 

 

 

 

 

 

 

 

 


In this case, GeneralCallBack will be invoked within a period of 60,000 milliseconds (one minute).  

Let us now consider the onSuccess(String) function callback which is periodically invoked by the SDK. Once invoked, the onSuccess(String) will produce the following String data format:  

  • *dd-MM-yyyy HH:mm:ss Status Code Response: **2200 -> ex: 01-01-2022 16:31:22 Status Code Response: 200

*Based on current device data and location (including the Time Zone) 

**Response code from the server  

Since GeneralCallBack is invoked periodically, do not place any object that can result in a memory leak.  

Now, we can input any application logic within the onSuccess function, such as event tracking, logging, and even the Firebase Event.  


INTEGRATING THE SDK - iOS

Latest version: 1.1.3

STEP 1 - Installation using Cocoapods

Add this line in your Podfile:

pod "QDPublisher", :git => 'https://github.com/datastreamx-plc/ios- data-acquisition-sdk.git', :tag => '1.1.3'

and then install by type pod install in your command lineTo install dependencies from cocoapods.

Sometimes the pod is not updated so you can clean cache and update pod using

pod cache clean --all pod udpate QDPublisher 

 
STEP 2
- Configure Info.plist

Update your location usage descriptions

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string><your location access description></string>
<key>NSLocationAlwaysUsageDescription</key>
<string><your location access description></string>
<key>NSLocationWhenInUseUsageDescription</key>
<string><your location access description></string>

Update your tracking manager description

<key>NSUserTrackingUsageDescription </key> <string><your tracking usage description></string>
 
STEP 3
- Setup Integration Key and Start Tracking

Register your integration key after app launch, after that you can setup your event and start tracking location, usually your AppDelegate.swift

Implement QDPublisherDelegate - iOS

After setting data-renderer-mark="true">publisher.delegate = self you need to implement PublisherDelegate

Implement QDPublisherDelegate - iOS

Basically, the API is same just different language. Here’s the full code for objective-c in AppDelegate.m

 

And don’t forget to add implement PublisherDelegate in AppDelegate.h

 


  • Ready to add an ethical, hassle-free revenue stream to your business?
Speak to our data consultant to start using Quadrant Location SDK