开发者

Control service in GUI

I am writing an app that uses a media player. I want to start the media player using the service so that the music can be played even if the application is closed (onDestroy is run). Should I use BindService (for control the service) and not un开发者_StackOverflow中文版Binding that?

the life cycle of the Service would be a bit tricky, start at playing screen created and stopped when either the music is complete in background or music is stopped when the app is finished (onDestroy)

how should i implement my service to best fit the above case i need?


Should I use BindService (for control the service) and not unBinding that?

No. You should call startService() to start it and stopService() to stop it (e.g., when the user presses the Stop button).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜