You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the service never has been started, the service is terminated by the system when the last client that was bound to the service unbinds. This is standard behaviour for services on Android. So you would have to start the service first as a foreground service and then manage the foreground state accordingly.
Recommended approach
If you only want to customize the notification, then you only need to provide a custom MediaNotificationProvider. You can do that by either a) customizing the DefaultMediaNotificationProvider, or b) subclassing a DefaultMediaNotificationProvider or c) writing your own implementation of MediaNotificationProvider.
Then use MediaSessionService.setMediaNotificationProvider(provider) in your onCreate method of the service to set the customized notification provider.
Please also see issue #216 that gives a bit more details about how you can do this approach.
Handling service state yourself
While this gives you full control it adds quite some fun to your media app development that I personally would try to avoid as an app. While it is possible to override onUpdateNotification, this is a complex topic and we are not able to provide support for this. It requires a bit of knowledge of services, foreground and bound services and their restrictions on various API levels.
I'm closing this issue because the DefaultNotificationProvider approach is covered in #216 and we can not give you support for overriding onUpdateNotification beyond the doc pointers above.
I tried to override the function onUpdateNotification.
But the service gets disconnected as soon as the user leaves the activity.
Is there a way so that we can provide the custom notification manger.
The text was updated successfully, but these errors were encountered: