A sample to show an optimal method of starting a foreground service
A common crash related to usage of foreground services is :
Context.startForegroundService() did not then call Service.startForeground()
To get rid of this use this strategy :
Instead of starting the service as a foreground service,
start the service as a background service, bind to it,
then when you have the service instance available in your
activity/UI component, you can directly call a method inside
the service which calls Service.startForeground() and adds the notification.