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.

Installation

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:

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

The SDK uses Gson and a few Google Play services

implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.google.android.gms:play-services-base:17.6.0'
implementation 'com.google.android.gms:play-services-ads-identifier:17.1.0'
implementation 'com.google.android.gms:play-services-location:18.0.0'

Since the SDK makes use of the AAID for ad use cases, the application manifest must include instructions for either AdMob or Google Ad Manager. Please refer to this Google post or the discussion on Stackoverflow

<meta-data android:name="com.google.android.gms.ads.AD_MANAGER_APP" android:value="true"/>
  • Please make sure you include the following proguard rules. In some cases Android is a bit too aggressive on cleaning and striping parts of the library.
-keep class io.glimr.sdk.network.GLRequestPayload { *; }
-keep class io.glimr.sdk.network.GLPostReqAsync { *; }
-keep class io.glimr.sdk.network.GLRequest { *; }

Gradle (mavenCentral)

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

Example

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();

๐Ÿ“˜

Questions?

Please reach out to us on [email protected]!