How to receive broadcasts of RINGER_MODE_CHANGED_ACTION

你说的曾经没有我的故事 提交于 2019-12-11 01:51:40

问题


I have the following broadcast receiver:

public class MyRingModeReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Logger.iLog("In my Receiver");
    }
}

I then have a service that onCreate does the following:

    IntentFilter filter = new IntentFilter();
    filter.addAction("android.media.RINGER_MODE_CHANGED");
    registerReceiver(new MyRingModeReceiver() , filter);

When I place a call to the emulator and use the volume keys to modify (silence) the ringer nothing happens. Any ideas of what it is that i am doing wrong?

Thanks.


回答1:


Apparently, the Intent Ringer_MODE_CHANGED is not called when you silence a ringer using the phone app ... Only when you modify the ringer outside of a phone call.



来源:https://stackoverflow.com/questions/3284693/how-to-receive-broadcasts-of-ringer-mode-changed-action

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