dependencies {
implementation 'eu.polestar:naosdk:4.+' // final '+' ensures you are using the latest version in the 4.0 series
}
Note: by default your android project should already have that line in the project build.gradle:
allprojects {
repositories {
jcenter()
}
}
Add Pole Star maven url in your project gradle:
maven { url "https://dist.nao-cloud.com/android/maven/" }
com.polestar.naosdk.managers.NaoServiceManager
. In that new class, you need not override any methods as in the example below. The purpose of that set-up is to allow different apps on the same device to integrate NAO SDK in isolation. package your.package;
import com.polestar.naosdk.managers.NaoServiceManager;
public class MyNaoService extends NaoServiceManager {}
<application>
block of your AndroidManifest.xml
: do not add a new process for this service. <service android:name="your.package.MyNaoService" />
AndroidGeofencingService
to receive wake-up notifications when arriving on-site by adding the following snippet to AndroidManifest.xml
(still in the <application>
block) <meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<service
android:name="com.polestar.naosdk.controllers.AndroidGeofencingService"
android:exported="true"
android:label="@string/app_name" />
<service
android:name="com.polestar.models.GeofenceTransition"
android:exported="true"
android:label="@string/app_name"
android:process=":geofencing" />
AndroidManifest.xml
: <!-- NORMAL PERMISSIONS: explicit user confirmation not needed -->
<!-- Internet connectivity (for data synchro) -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Used for BLE-based location -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!-- Used for WiFi-based location -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!-- SENSITIVE PERMISSIONS: user will be prompted for acceptation by Android OS -->
<!-- access to OS Loc / GPS and BLE sensor (since Android 6)-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Add permission WRITE_EXTERNAL_STORAGE (limited to sdk<=18) -->
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
The SDK uses Google Play services (location service) as dependency.
com.google.android.gms:play-services-location:11.4.0
If your application also have it as dependency, it is recommended to use the same version as our SDK to avoid errors. Also, make sure you have Google’s repository added to your top level build.gradle file:
maven { url "https://maven.google.com" } or google()
If you absolutely need to use another version of the Play services, make sure you use gradle 3.0+ in your top level build.gradle file, update gradle if needed:
classpath 'com.android.tools.build:gradle:3.0.0'
then use “implementation” or “api” keyword instead of “compile“:
implementation 'com.google.android.gms:play-services-location:<another version>'