To use portal.sensorberg.com you must do the following:
1. Add the following static initializer in your Application class
2. Use the a different artifact of the SDK
That's a temporary measure while our users migrate to the new portal.
How to install the Sensorberg Android SDK
You will need to have the jcenter artifactory in your list of repositories and declare the dependency to our sdk.
Declare your BroadcastReceiver:
You cannot add a BroadCastReceiver at runtime! We are using a LocalBroadcastManager to send the broadcast and find the receiver(s).
The BroadcastReceiver is running in another process
You should be aware, that the Sensorberg Android SDK is running in a separate process. The broadcast will be sent in the separate process as well. The intention of the BroadcastReceiver is to present the content of your Action when the app is in background.
Enable the SDK in your Application object and register foreground/background notifications:
It´s now time to implement the BroadcastReceiver:
This class receives a broadcast, if the SDK has detected a beacon and successfully resolved an associated Action.
There’re several ways of acquiring Advertiser ID which varies per platform. Here we’ll show for the Google ID.
And of course, if you need to remove it, just call it null
Android 6 Permissions
If you app will target android 6 you will need to prompt the user for location permissions before scanning will work - this should be down in the activity. For
a more in-depth discussion please see the Android 6 blog.
In your activity which would use the scanner you need to ask for (location permission) at runtime:
Then you must receive the callback.
Please note that if you're using geofencing dev preview branch the permission ACCESS_FINE_LOCATION is required in your manifest. This is caused by Google Play Services requirements under the hood.
If ACCESS_FINE_LOCATION is not given you won't receive geofence notifications, but you can still receive those generated by beacons, provided your app holds ACCESS_COARSE_LOCATION permission
Tip: Pretty ADB log with Android Bluetooth messages hidden
Use pidcat with grep to show your log and hide the System Bluetooth scan logs: