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

STEP 1 - In Android Studio, open build.gradle of the app (the project level), and add codes as highlighted in yellow:
7
STEP 2 - Open build.gradle of the app (the app-specific level), and add this under the 'dependencies' code section (highlighted in yellow):
 
implementation 'io.quadrant.sdk.locationdata:data-acquisition-sdk:<latest version>'
 

Latest version: 1.0.0

8
STEP 3 - Sync the gradle files, now let’s try calling the setup method for initiating the monetization SDK, fill in INTEGRATION_KEY with the that you fetched from the dashboard.
 
and that's it!
 
If you try accessing a method from the library in your code, it should work.
 
Client.getInstance().setup(MainActivity.this, true, false, INTEGRATION_KEY, new Client.ResultCallback() {
@Override
public void onSuccess(String result) {
//start location data collection
}

@Override
public void onError(String result) {
//add error condition/ alert
}
});

Example:

9

Congratulations! You have successfully integrated the library into your android project!

TRACKING LOCATION - ANDROID

STEP 1 - The library requires three permissions to run properly. Declare them in your app manifest.xml file.

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>


STEP 2 -
And to start collecting, call this method

Client.getInstance().startTrackingLocation();

 

Make sure to call the above method inside onSuccess() callback method  Client.getInstance().setup() that we declared before. As shown below:

10

Congratulations! You have now configured everything required for location tracking!

INTEGRATING THE SDK - iOS

STEP 1 - Installation using Cocoapods

Add this line in your Podfile:
pod "QDPublisher", :git => 'https://github.com/datastreamx-plc/ios-data-acquisition-sdk.git'

and then install by type pod install in your command line

 

STEP 2 - Register integration key

Register your integration key after app launch, usually your AppDelegate.swift

  • import QDPublisher to use this framework

  • Setup your integration key and error handle in didFinishLaunchingWithOptions 

import QDPublisher

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

let publisher = QDPublisher.service
let integrationKey: String = "your integration key here"

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {

QDPublisher.service.setup(integrationKey)
QDPublisher.service.connectionErrorHandler = { error in
// handle error here
}
}
}
    • TRACKING LOCATION - iOS

      For location tracking, you can use this code QDPublisher.service.track(choosedLocation) in your location service, it usually looks like this: 

    • func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
      guard let choosedLocation: CLLocation = locations.first else { return }
      QDPublisher.service.track(choosedLocation)
      }

       


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