android – Java阻止kitkat 4.4中的传入短信

我正在开发一个
Android应用程序,它将阻止来自特定数字的传入短信我已成功实现此目的.该应用程序在4.4.4版以外的其他版本中运行良好.我已经设定了它的优点,但没有任何对我有用.

这是清单中接收器的代码

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

我通过在java中调用此方法来阻止短信

this.abortBroadcast();

我搜索解决这个问题,发现在kitkat中应用程序需要设置为默认消息传递应用程序以中止msg.但我想以编程方式执行此操作.有没有办法以编程方式阻止kitkat中的传入短信???

最佳答案

I search to solve this problem and found that in kitkat the app need to set as default messaging app to abort the msg

API级别19及更高级别就是这种情况.目前,那是~60% of Android devices actively using the Play Store.

But i want to do this programatically

欢迎您要求用户将您的应用程序设置为默认的SMS客户端,via an ACTION_CHANGE_DEFAULT Intent.除了某些安全漏洞之外,您无法通过Android SDK强制您的应用程序成为默认的SMS客户端.

Is there any way to block incoming sms in kitkat programatically?

编写具有SMS阻止功能的完整SMS客户端.

点赞