即使我退出应用程序,如何从WebView播放音频?
我正在Android Studio中开发一个Android应用程序,并且声音必须在网络浏览器上播放。但是,当我关闭应用程序时,它会自动停止播放音频。现在,我想知道即使关闭应用程序,我如何使音频在后台播放。 (请提供代码,我是Android开发的新手。)谢谢。
I'm developing an Android App in Android Studio and in that a sound has to play on the WebView. But when I close the app, it automatically stops playing the audio. Now I want to know how do I make the audio to play in the background even if I close the app. (Kindly provide the code, I'm new to android development.) Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对不起,我认为这是不可能的。
要在后台播放声音,您需要在服务中播放音频。
这只是播放背景声音的一种方法。
我将显示一个代码:
I am sorry, I think it's impossible.
To play a sound in background, you need to play the audio in Service.
It's only one way to play background sound.
I will show a code for that: