broadcastreceiver onReceive problem ACTION_MEDIA_BUTTON Android

五迷三道 提交于 2019-12-06 11:39:22

First, you should stop using Toast as your diagnostic test. Use the Log class to log to LogCat, or breakpoints, or something.

Next, you should get rid of your MediaButtonIntentReceiver constructor, as it is not needed.

Then, I would dump the if (!Intent.ACTION_MEDIA_BUTTON.equals(v_IntentAction)) block, since it is also not needed.

Next, I would make sure that your media button actually works. Does it control other applications, like a music player? It may be that your media button is not Android-compliant or something.

Use android.intent.action.MEDIA_BUTTON Instead in your manifest. Check : http://developer.android.com/training/managing-audio/volume-playback.html

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