Since Android Oreo was released, the location updates in background are very limited :

  • Your app can have a new location only a few times each hour (every 10-15 min.).
  • The average responsiveness of a geofencing event is high (you must stay at least 5-10 min in your zone).
  • You can only launch Wifi scans, a few times each hour.

To be able to receive any location update under 10 minutes, you need to start a foreground service. Thus the CT's SDK use this solution. To be more flexible, we let you define your own customized notification.

Custom-made Notification

You can change several things :

  • The icon of the notification by overriding, the following drawable :
    • Android 4-: R.drawable.icon_notification_android_4
    • Android 5+: R.drawable.icon_notification
  • The title of the notification by overriding, the following string: foreground_notification_title
  • The description of the notification by overriding, the following string: foreground_notification_description
  • The description of the cancel button by overriding, the following string: foreground_notification_delete_action

Configuration example and results :

    <string name="foreground_notification_title">GeodetectionSample</string>
    <string name="foreground_notification_description">Looking for nearby point of interests</string>
    <string name="foreground_notification_delete_action">Delete me</string>


You can also change some behaviors of the foreground notification, by creating a file called params.xml, in your values folder :

  • By default, the foreground notification has a timeout of 5 sec., when the timer is reached the service is destroyed to prevent the user from having an annoying experience with your application. You can increase this duration as you want by overriding the foreground_notification_timeout variable.
  • You can completely disable the foreground notification process, by overriding the variable is_foreground_notification_active.
  • Last, but not least, you can display or hide a button usable by the user to delete the notification, you need to override the variable is_delete_intent_active
<?xml version="1.0" encoding="utf-8"?>
    <integer name="foreground_notification_timeout">300000</integer>
    <bool name="is_foreground_notification_active">true</bool>
    <bool name="is_delete_intent_active">true</bool>