Android 媒体播放器服务
我希望启动一个 Service
来在用户关闭应用程序时继续播放音乐。我已经做了很多搜索,我真正想要的只是一个简单的例子,它允许我在用户按下按钮时启动服务和音乐。当用户在其他时候返回应用程序并按下另一个按钮时,我想绑定到服务并停止音乐播放。我做了很多搜索,我希望有人能给我一个清晰的解释,解释这一切是如何工作的,甚至可能是一个代码示例。
I am looking to start a Service
to keep music playing from my app when the user closes it. I have done a lot of searching around and all I am really looking for is a simple example that will allow me to start the service and music when the user presses a button. And when the user comes back to the app at some other point and presses another button then I want to bind to the service and stop the music playback. I have done a lot of searching around and I was hoping that someone could give me a clear explanation of how this all works and maybe even a code example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用此片段代码播放SD卡中的歌曲:
更多在服务中运行的android媒体播放器的示例代码,您可以参考本教程。
to play song in Sd card using this snippet code:
more example code for android mediaplayer run in service,you can make reference to this tutorial.
我已经实现了这个音乐服务类,它运行良好
I have implemented this musi cservcie class which is working fine