中止短信广播和/或删除收件箱中收到的短信 [英] Abort sms broadcast and/or delete received sms from inbox
问题描述
我试图写短信加密工具。使用这个工具的人将可以通过短信没有互联网聊天并保持加密。
我唯一需要的就是如何从进入收件箱文件夹阻止特定数量的短信,或删除短信通知,然后从收件箱中删除的短信。
我GOOGLE了很多,但
http://stackoverflow.com/a/3875736/705297
这是行不通的。广播是工作,我看到的BroadcastReceiver启动日志消息,但不会中止播出。
此外,我发现很多,这是不可能的消息。因此,它是可能的,我该怎么办呢?我使用的是Android 2.1及更高版本。
谢谢
code(只是尝试取消用于测试所有SMS):
广播接收器:
@覆盖
公共无效的onReceive(上下文的背景下,意图意图)
{
abortBroadcast(); }
清单的部分:
<使用许可权的android:NAME =android.permission.RECEIVE_SMS/> <接收机器人:SMSReceiverNAME =>
<意向过滤器的android:优先=1000>
<作用机器人:名字=android.provider.Telephony.SMS_RECEIVED/>
&所述; /意图滤光器>
< /接收器>
我也需要有BROADCAST_SMS许可。这是我的问题。这里是清单的工作的一部分。
<使用许可权的android:NAME =android.permission.BROADCAST_SMS/>
<使用许可权的android:NAME =android.permission.RECEIVE_SMS/>
....
<接收机器人:SMSReceiverNAME =机器人:权限=android.permission.BROADCAST_SMS>
<意向过滤器的android:优先=1000>
<作用机器人:名字=android.provider.Telephony.SMS_RECEIVED/>
&所述; /意图滤光器>
< /接收器>
I am trying to write sms encryption tool. People using this tool will be able to chat without internet via sms and stay encrypted. The only thing I need is how to stop sms from particular number from getting into inbox folder, or delete sms notification and then delete sms from inbox.
I googled a lot, but http://stackoverflow.com/a/3875736/705297 this is not working. Broadcast is working, I see the log message that broadcastreceiver is launched, but it doesn't abort broadcast.
Also I found lots of messages that it is impossible. So is it possible and how I can do that? I am using android 2.1 and higher. Thanks
Code (just tries to cancel all sms for testing purposes): Broadcast receiver:
@Override
public void onReceive(Context context, Intent intent)
{
abortBroadcast(); }
Part of manifest:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<receiver android:name=".SMSReceiver">
<intent-filter android:priority="1000">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
I also need to have BROADCAST_SMS permission. That was my problem. Here is the working part of manifest.
<uses-permission android:name="android.permission.BROADCAST_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
....
<receiver android:name=".SMSReceiver" android:permission="android.permission.BROADCAST_SMS">
<intent-filter android:priority="1000">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
这篇关于中止短信广播和/或删除收件箱中收到的短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!