我的应用程序处理小区广播消息,这是一个无序广播。我希望我的应用程序接收此广播并终止CB消息的消息通知。
我发现可以通过使用带有优先级标签的意图过滤器来抑制SMS通知,如下所示
<receiver android:name="com.example.sis.xxyyReceiver" >
<intent-filter android:priority="999">
<action android:name="android.provider.Telephony.SMS_RECEIVED" >
</action>
</intent-filter>
</receiver>因此,我尝试对CB消息执行相同的操作,如下所示
<intent-filter android:priority="100">
<action android:name="android.provider.Telephony.CB_RECEIVED" >
</action>
</intent-filter>但是它没有工作,并且log cat看起来如下所示

从我的研究和下面的评论中,我了解到无序广播是不能中止的,所以我想做的就是抑制CB消息产生的通知(即CB_SMS警报和振动)。
有人能帮我解决这个无序广播通知中止的问题吗??
发布于 2013-06-12 22:40:10
或者,你可以调低音量?
或者可能只是模拟蓝牙耳机挂钩自动应答呼叫(静默)?
Intent i = new Intent(Intent.ACTION_MEDIA_BUTTON);
i.putExtra(Intent.EXTRA_KEY_EVENT,
new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_HEADSETHOOK));
context.sendOrderedBroadcast(i, "android.permission.CALL_PRIVILEGED");
Intent o = new Intent(Intent.ACTION_MEDIA_BUTTON);
o.putExtra(Intent.EXTRA_KEY_EVENT,
new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HEADSETHOOK));
context.sendOrderedBroadcast(o, "android.permission.CALL_PRIVILEGED");发布于 2013-04-24 21:07:39
您不能中止常规广播。所有为他们注册了BraodcastReceiver的人都会得到他们。
https://stackoverflow.com/questions/16192525
复制相似问题