如何删除收件箱中短信的机器人编程?收件箱、机器人、短信

2023-09-11 10:56:45 作者:人心所向便是光√

在Android手机注册到应用程序的短信也被发送到设备的收件箱。然而,以prevent凌乱,它会是好的能够从收件箱中删除应用程序特定的SMS消息,以减少这些邮件的潜在溢出。

On Android phones SMS messages registered to applications also get sent to the device's inbox. However to prevent clutter, it'd be nice to be able to remove application specific SMS messages from the inbox to reduce the potential overflow of those messages.

似乎在其他谷歌组上得到的一种编程方法,一个明确的答案删除从Android收件箱中短信的问题不被pressing。

Questions on other Google groups on getting a definitive answer on a programmatic way to delete SMS messages from the Android inbox don't seem to be pressing.

所以,这种情况下:

在Android应用程序的启动。 注册短信类型的X,Y和Z 在消息P,Q,X,Y,超过时间的推移ž流,所有存放在收件箱 在Android应用程序检测收到的X,Y,Z(presumably作为程序中断事件的一部分) 在过程中的X,Y,Z 的 Desirement !!! 的X,Y,Z是从Android收件箱中删除 Android App startup. register SMS message types X,Y and Z messages P,Q,X,Y,Z stream in over the course of time, all deposited in inbox Android application detects receipt of X,Y,Z (presumably as part of the program interrupt event) process X,Y,Z Desirement!!! X,Y,Z are deleted from the Android inbox

是否已完成?能不能做到?

Has it been done? Can it be done?

推荐答案

作为了Android 1.6的,收到的短信广播( android.provider.Telephony.SMS_RECEIVED )是交付一个有序的广播 - 这意味着你可以告诉哪些组件应该首先接收广播系统

"As of Android 1.6, incoming SMS message broadcasts (android.provider.Telephony.SMS_RECEIVED) are delivered as an "ordered broadcast" — meaning that you can tell the system which components should receive the broadcast first."

这意味着你可以拦截来袭的消息,并中止它的广播进一步上。

This means that you can intercept incoming message and abort broadcasting of it further on.

在你的的Andr​​oidManifest.xml 文件,确保有优先级设置为最高的:

In your AndroidManifest.xml file, make sure to have priority set to highest:

<receiver android:name=".receiver.SMSReceiver" android:enabled="true">
    <intent-filter android:priority="1000">
        <action android:name="android.provider.Telephony.SMS_RECEIVED" />
    </intent-filter>
</receiver>

在你的的BroadcastReceiver 的onReceive()的方法,用你的邮件执行任何操作之前,只需调用 abortBroadcast();

In your BroadcastReceiver, in onReceive() method, before performing anything with your message, simply call abortBroadcast();

编辑:作为奇巧,这不工作了明显

As of KitKat, this doesn't work anymore apparently.

EDIT2:如何做到这一点的奇巧更多资讯:

More info on how to do it on KitKat here:

Delete从Android的短信在4.4.4(受影响的行数= 0(零),删除后)

 
精彩推荐