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.

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.

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.

Android 10 background location permission

Android 10 added an additional level of permission for users to control whether an application can access the device location from the background. The new background location permission ACCESS_BACKGROUND_LOCATION has been added to the SDK’s Android Manifest. When requesting location permissions, the app should also request this permission, otherwise the user will only be prompted to “Allow only while using the app”.

If your app is not using the foreground service implementation of Bluedot service and the user selects “Allow only while using the app” permission, then the Bluedot SDK cannot guarantee to generate triggers if your app is moved to the background as the application and SDK will not be getting location updates from the operating system. If receiving triggers from the background is vital, we suggest either using the foreground service, or communicating to the user the value of allowing access to location data from the background.

Google Play Services out of date

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.

Created by Bluedot DevOps on June 19, 2018

Start the discussion