Android – Implementing a Foreground Service

Implementing a foreground service is best practice for ensuring users are fully aware of how and when their location is accessed and also for the most efficient use of system resources.

When implementing the Bluedot SDK as a foreground service, there will be a persistent notification (for Android 0 and above) in the notification tray informing the user that your app is accessing device location when the app is in the foreground and background.

Example project 

Our Integrating the Android SDK steps you through integrating the Bluedot Point SDK into your app. The beginning of the guide also points you to our GitHub Minimal Integration example which includes a Foreground Service implementation (see line: 74).In the guide, you can specifically see how to set a foreground service in the Application Integration section 

Within that tab, focus on the section that follows the comment line: 

// Setting Notification for foreground service, required for Android Oreo and above.

You may also want to read more from Android’s own Services overview documentation

About the notification

Once a foreground service has been implemented, you’ll see the persistent notification in the notification tray.

The notification is persistently displayed when the SDK service is running (Eg. the SDK has been authenticated/started), but stops displaying once the SDK is logged-out. So whether the notification shows constantly or only occasionally, will be dependent on your use-case and implementation approach.

 

Other related documentation

 

If you have any questions about implementing a Foreground Service, contact our engineering team on help@bluedot.io

Created by Daniel Toro on April 7, 2020