Android – Caveats

ServiceStatusListener and ApplicationNotificationListener callbacks

These callbacks should be thread-safe and should not update UI views directly. They should be wrapped into runOnUiThread or communicated to the UI thread using a Handler.

Autostart SDK on boot complete

In order to Autostart the SDK on boot complete, it is mandatory to implement SDK authentication at the Application class level and set restartFlag to true. Please refer the AutoStart of SDK page for detail information.

Services are not declared in AndroidManifest.xml

It is mandatory to declare BlueDotPointService and DataJobScheduler (if API Level > 23) in the AndroidManifest.xml file. If service(s) are not declared in AndroidManifest.xml and ServiceManager is instantiated, it will throw BluedotException visible in ADB LogCat, stating the cause of the Exception.

Android Marshmallow permissions

Since the release of Android 6.0 (Marshmallow), permissions are no longer accepted during installation and instead invoked while running the app. If the app’s target SDK is set to API Level 23 or higher, then the Point SDK will not authenticate if the user has not granted the permissions requested by the SDK. If an app invokes authentication of the Point SDK without the required permissions granted, then the SDK will throw an error using the callback method onBlueDotPointServiceError. The error message can be accessed by invoking method getReason of BDError object. The App can invoke custom permission request flows prompting the user to accept the required permissions.

A simple example of integrating Point SDK and handling runtime permissions in Marshmallow is available here. More information on Android runtime permissions is available here.

 

Google Play Services out of date

Google Play Services are not required by the Point SDK for Android; however, apps using Google Maps to display the user’s current location on a map depend on Play Services. It is possible that some Android devices with an OS version less than 4.4 may not have an up-to-date version of Google Play Services installed. The error message: Google Play Services out of date. Requires xxxxxxx but found xxxxxxx in logcat indicates that the version of Google Play Services installed on the device requires an update. Visit the Google Play Store to download and install the latest Play Services.

Android 8 (Oreo) background support and notification

The service infrastructure of the Point SDK for Android has been re-engineered to be compatible with Android O. In Android O, it is necessary to set a notification that appears in the notification tray to let the app user know that location is being used in the background. If you are targeting Android O or higher, then call ServiceManager.setForegroundServiceNotification API to set the notification, which will be displayed on devices running Android O and above.

If the notification is not set, a fatal error is delivered to the app. Refer to ForegroundNotificationNotSetError for additional information. To display foreground notification in Android versions older than Android O to maintain app consistency, set the targetAllAPIs flag to true.

Please review the Android 8 foreground notification guide to customize messages for your users.

Created by Bluedot DevOps on June 19, 2018

Start the discussion