SMS Received in my SMS app and in Hangouts, although I call abortBroadcast()

前端 未结 2 1580
小蘑菇
小蘑菇 2020-12-30 17:24

I have an SMS blocker Android application developed myself which was working quite well capturing all the spams until recently Google updated its Hangouts app to work with S

相关标签:
2条回答
  • 2020-12-30 17:57

    When you register receiver, set priority of filter to INTEGER.MAX_VALUE. Now abortBroadcast() will work;

        receiver = new HightPrioritySmsReceiver();
        IntentFilter filter = new IntentFilter("android.provider.Telephony.SMS_RECEIVED");
        filter.setPriority(Integer.MAX_VALUE);
        registerReceiver(receiver, filter);
    
    0 讨论(0)
  • 2020-12-30 18:09

    Hangouts uses the maximum possible priority (999 per the Intent-Filter docs) and therefore you cannot abort it on <4.4 releases. On 4.4+, only the default SMS app (blog post with details) can receive SMS notifications - users would need to set your app as the default SMS app for your app to function correctly (although it should function as expected if that happens).

    0 讨论(0)
提交回复
热议问题