PathSense Android SDK How to customize notification using PathsenseNotificationFactory

The PathSense SDK runs as a foreground service and will post a foreground notification while in use.

By default, it will show the PathSense icon and read "Pathsense is running". You can fully customize this notification by implementing and providing your own foreground notification.

Setup includes the following:

  1. Implement and override the desired functionality. See javadoc
    • createForegroundNotification: Returns the foreground notification used by PathsenseLocationProviderAPI.
    • createForegroundNotificationId: Returns the ID used for foreground notification.

      ** Note: Returning the same notification and ID used by all other app foreground services allows the foreground notification to be shared and results in a single foreground notification. See android javadoc

  2. Add under the <module-dir>/src/main/assets folder of your app. Add the /assets folder if not already there.
  3. Set the following property notification_factory_class to the fully qualified class name.

    In <module-dir>/src/main/assets/

  4. Update your proguard rules to prevent obfuscation of the notification factory class.

    In <module-dir>/

    -keep class com.myapp.MyPathsenseNotificationFactory {