SDK integration - ANDROID

The Glimr SDK Lite focuses on location data from devices in foreground. To save battery the SDK uses the last known location of the device. 

- Permission requirements, some are optional: `INTERNET, ACCESS_WIFI_STATE, ACCESS_NETWORK_STATE, ACCESS_FINE_LOCATION`

- The SDK uses `Gson 2.2.4` and `Google Play Service 11.4.+`. 

Gradle (jcenter)

implementation 'io.glimr.geo:glimr-sdk-lite:3.0.1'

Basic code

GLManager manager = GLManager.getInstance();
manager.init(this.getApplicationContext(), <API_TOKEN>, false, 90);

// Limit the maximum decimals for a GPS fix to be sent to the service (default 5)
manager.setGeoFixDecimals(4);

// Optionally use cached tags 
Log.i("cached", "getCachedGlimrTags raw: " + GLManager.getInstance().getCachedGlimrTags());

// Callback for fresh tags
GLManager.getInstance().setGlimrTagsCallback(new GLEvent() {
    @Override
    public void glimrTagsUpdated(HashMap<String, ArrayList<String>> map) {
        Log.i("response", "glimrTagsUpdated raw: " + map);
        Log.i("response", "glimrTagsUpdated list: " + GLManager.mapToArrayList(map));
        Log.i("response", "glimrTagsUpdated query string: " + GLManager.map2QueryString(map));
    }

    @Override
    public void tagsUpdateError(int responseCode, String errorMessage) {
        Log.i("response", "tagsUpdateError raw: " + responseCode);
    }
});
GLManager.getInstance().getGlimrTags();

 

SDK Implementation - iOS

xml
<key>NSLocationWhenInUseUsageDescription</key>
<string>This uses location data</string>
NSUUID *apiToken = [[NSUUID alloc] initWithUUIDString:GLIMR_API_TOKEN];

GLAudienceManager *audienceManager = [[GLAudienceManager alloc] initWithApiToken:apiToken geoFixDecimals:4];

NSLog(@"Cached tags %@", [audienceManager cachedTags:GLTagResponseFormatFlat]);

[audienceManager glimrTagsWithCompletion:^(NSDictionary *audiences, NSError *error) {
    NSLog(@"Tags %@", audiences);
}];