Block incoming/outgoing SMS on Android

后端 未结 2 1390
被撕碎了的回忆
被撕碎了的回忆 2021-02-06 17:52

Does anyone know a reliable way to block incoming/outgoing SMS messages through code? It\'s ok if the actual SMS messages are being received, but I would like to block any notif

2条回答
  •  攒了一身酷
    2021-02-06 18:56

    Regarding blocking of incoming sms. You can register broadcast receiver with high priority so your code gets called before system app is called. Than in broadcast receiver, you can abort the broadcast and other apps won't see it.

    register receiver in manifest:

    
        
            
        
    
    

    and then in broadcast receiver:

    @Override
    public void onReceive(Context context, Intent intent) {
        abortBroadcast();
    }
    

提交回复
热议问题