简体   繁体   中英

Java Block Incoming SMS in kitkat 4.4

I am developing an android application that will block incoming sms from specific numbers i have successfully achieved this. The app is working fine in other versions except the version 4.4.4. I have set its periority but nothing worked for me. here is the code for receiver in manifest

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

and i am blocking the sms by calling this method in java

this.abortBroadcast();

I search to solve this problem and found that in kitkat the app need to set as default messaging app to abort the msg. But i want to do this programatically. Is there any way to block incoming sms in kitkat programatically???

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

That is the case for API Level 19 and higher. At the moment, that is ~60% of Android devices actively using the Play Store .

But i want to do this programatically

You are welcome to ask the user to make your app be the default SMS client, via an ACTION_CHANGE_DEFAULT Intent . You cannot force your app to be the default SMS client through the Android SDK, outside of some security flaw.

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

Write a full SMS client that has SMS-blocking capabilities.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM