How to interrupt broadcast notification? (for unordered broadcasts)

My application deals with cell broadcast messaging, which is an unordered broadcast. I want my application to receive this broadcast and kill the CB message.

I found out that SMS notification can be suppressed using an intent filter with a priority tag, as shown below.

<receiver android:name="com.example.sis.xxyyReceiver" > <intent-filter android:priority="999"> <action android:name="android.provider.Telephony.SMS_RECEIVED" > </action> </intent-filter> </receiver> 

So, I tried to do the same with CB messages such as

 <intent-filter android:priority="100"> <action android:name="android.provider.Telephony.CB_RECEIVED" > </action> </intent-filter> 

But this did not work, and the log code is as follows

enter image description here

From my research and the comments below, I found out that unordered broadcasts cannot be interrupted, so all I want to do is to suppress the notification (i.e. CB_SMS warning and vibration) generated by the CB message.

Can someone help me with this interruption of the notification of non-standard broadcasts?

+6
source share
2 answers

Alternatively, can you turn off the volume?

Or maybe just emulate the hook of the bluetooth headset to answer the call automatically (quietly)?

 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"); 
0
source

You cannot interrupt regular broadcasts. Everyone who has registered a BraodcastReceiver for them will receive them.

+6
source

Source: https://habr.com/ru/post/943535/


All Articles