Nodle SDK - Android Integration

Integrating the Nodle SDK into your android app is easy and straightforward. Just follow the steps below and you should be ready to go in no time.

Step 1: Generate Developer Key

  • Go to the Nodle Dashboard, https://dashboard.nodle.io. Create an account and sign-in.

  • In the Dashboard panel, click on Generate Devkey.

  • Enter a name; possibly the name of the app for which the key is being generated.

  • Hit Generate. Your new developer key will show up in the list.

Step 2: Add the jitpack repository

Add the code below in your project'sbuild.gradle to add the jitpack repository

allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}

Step 3: Add the nodlesdk dependency

In your app module's build.gradle add the Nodle SDK dependency

​
dependencies {
// Nodle SDK
implementation 'com.github.NodleCode.nodlesdk-android:nodlesdk:1.2.6'
}
​

Please node that nodlesdk uses google play location service to get a gps fix. If your app runs on devices that doesn't have google play service (gps), you can use a different flavour of the nodlesdk that doesn't depend on google play, it will use the default android location api instead:

​
dependencies {
// Nodle SDK
implementation 'com.github.NodleCode.nodlesdk-android:nodlesdk-nogps:1.2.6'
}
​

You may also need to add the following Java8 compatibility to the build.gradle of your app module.

android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

Step 4: Run the Nodle SDK

In the onCreate method of your launcher activity, set the developer key generated in Step 1 and start Nodle like so:

Nodle.onStart(this, "your_developer_key");

Step 5 - Check Permission

The nodle SDK requires access to bluetooth and the device location to run. Please remember to request the following permissions from the user:

  • INTERNET

  • BLUETOOTH

  • BLUETOOTH_ADMIN

  • ACCESS_FINE_LOCATION

  • ACCESS_COARSE_LOCATION

You may use third party libraries such as the vanniktech library with RxPermission like so:

RealRxPermission.getInstance(this)
.requestEach(
Manifest.permission.INTERNET,
Manifest.permission.BLUETOOTH,
Manifest.permission.BLUETOOTH_ADMIN,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION)
.reduce(true,
(c, p) -> c && (p.state() == Permission.State.GRANTED))
.subscribe(
(granted) -> {
if (granted) {
Log.d("Nodle","all the permissions was granted by user");
Nodle.onStart(this, "your_developer_key");
}
else {
Log.d("Nodle","some permission was denied by user");
}
});

And there you have it! You’re good to go!

​