Find if speaker is in use?

a 夏天 提交于 2019-12-08 03:09:45

问题


In Android , is it possible at any given time to find if speaker is in use and if so which app is using it.

Sorry i did not know how to phrase the question. What i want to do is find out if any app (Music Player) is playing a music file either using the loud speaker or the ear phones. Also if possible find which app is using it.

Sorry Don't know how else to phrase this.


回答1:


I needed this to find if music is currently playing on the device. I found the function isMusicActive() under AudioManager. It returns true only when music is actually playing, its false evnen when player is in foreground and paused. Its worked for me so far.



来源:https://stackoverflow.com/questions/14618202/find-if-speaker-is-in-use

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!