在 Android 上阻止传入/传出短信
有谁知道通过代码阻止传入/传出短信的可靠方法?如果收到实际的短信也没关系,但我想阻止收到该短信的任何通知。此外,不应允许用户发送(或者最好是键入)SMS 消息。这可能吗?
谢谢
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 notifications of that SMS being received. Also, the user shouldn't be allowed to send (or prefferably even type) an SMS message. Is that possible?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法阻止外发短信。
这是我用来阻止传入文本的方法。
SmsReceiver.java
AndroidManifest.xml
从清单中删除的主要内容是服务块、接收器块和权限。
You can't block outgoing text messages.
Here's what I use for blocking incoming texts.
SmsReceiver.java
AndroidManifest.xml
The main thing to take away from the manifest is the service block, receiver block, and the permissions.
关于阻止传入短信。您可以以高优先级注册广播接收器,以便在调用系统应用程序之前调用您的代码。与广播接收器相比,您可以中止广播,其他应用程序将看不到它。
在清单中注册接收器:
然后在广播接收器中注册:
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: