im currently developing an app which plays the steam audio using MediaPlayer class. And i’d declare its main (Player) activity as SingleTop. Also on button “Back” it does moveTaskToBack(true) which acts the same as button Home does. So it just stays and plays on background and if user wants to see the gui he just starts the app once again (which is less convenient) or he clicks the special app’s notify. Exit provided via menu.
but what are the benefits of using service instead of activity in such case? Definitely it would be more complex to develop, i have to say. Even instantiating the GUI while “on background” will take much more time, i’m afraid.
im currently developing an app which plays the steam audio using MediaPlayer class. And
Share
From the Android Documentation:
also
The Android OS can destroy your Activity if it runs out of resources, but it won’t destroy the service.
EDIT: you should use
startForeground()to ensure yourServicewon’t be killed in situations where the resources are low. From the docs: