I want to create a MusicPlayer application which leverages the features of MediaBrowserService. While going thru documentation of MediaBrowserServiceCompat, I realized it is a subclass of Service, which means it runs on Application's main UI thread.
But since music player is a long running task, I suppose its best to implement it as an IntentService
, rather than as Service.
So I wanted to ask:
Where should I implement my MusicPlayer service?
Should I implement it within
MediaBrowserServiceCompat
implementation? But will it not make too heavy on UI thread?Or should I implement it as an
IntentService
& call it from my MediaBrowserServiceCompat? But it seems bit complex.
Here is my initial code structure
Please suggest.
Thank You
Wrong :
Doc clearly say :
And it also said if you need some kind of long time task, you should implement as Foreground Service.