我目前正在编写一个 SMS 控制的 GPS 追踪器。每次我向设备发送短信时,它都会像普通短信一样处理(收件箱和通知中的新消息),但这些短信只是为了控制应用程序。
是否可以关闭这些短信的通知?我也不希望收件箱文件夹中的所有这些短信...
创建您的广播接收器以接收短信。设置具有最高优先级的意图过滤器。
<intent-filter android:priority="100">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
在您的接收器类中, abortBroadcast() 方法不会通知 SMS。
并删除当前收到的消息。
yes this is possible you need to use this method into the broadcast receiver at last
abortBroadcast();
This will cancel the broadcasting to the user.