如何通过我的Android应用控制背景音乐? [英] How to control background music from my Android app?
问题描述
我想制作一个应用程序内小部件,该小部件可以暂停/播放和向前/向后切换音乐,适用于Android的锁屏应用.我尝试了一些不同的方式,例如与Mediaplayer或Intent合作,但这对我没有帮助.我需要我的应用程序来控制所有来源的音乐:Web浏览器,本地音乐应用程序,具有音乐播放支持的社交网络应用程序等等.与之接近的是Sony Xperias作为小部件.所不同的是,我的将不会是小部件,我希望它在应用程序内部使用,以代替本机锁定屏幕. 希望我的问题清楚.
I want to make an in-app widget, that can pause/play and switch music forward/backward for a lockscreen app for Android. I've tried some different ways, such as working with mediaplayer or Intent, but this didn't help me. I need my app to control music from all the sources: web browser, native music app, social networking apps with music playback support and so on. Something close to that is made in Sony Xperias as a widget. The difference is, that mine won't be a widget, I want it to use inside an application, that replaces the native lockscreen. Hope that my question is clear.
推荐答案
我找到了适用于Android 4及更高版本的答案: http://forum.xda-developers.com/showthread.php?p=45288378
I've found the answer for Android 4+ versions: http://forum.xda-developers.com/showthread.php?p=45288378
这篇关于如何通过我的Android应用控制背景音乐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!