On Android KK, how does one disable the SMS sent by the third-party APK?

Source: Internet
Author: User

On Android KK, how does one disable the SMS sent by the third-party APK?
The sms framework architecture was modified on KK and the default application concept was introduced.
If multiple APK messages are installed on the mobile phone, you must set one as the default AP. Only the default AP has the permission to read and write the database.
If a non-default AP sends a multimedia message, the Framework writes the text message to the database.

In versions earlier than KK, if the third-party Apk sends a text message, as long as the apk does not write the text message into the database, it will not be displayed.
For Versions later than kk, if the third-party APK sends text messages, although this apk does not write the text message content into the database, it is not the default AP, after sending the message, the framework detects this situation and then writes the text message to the database.

Take the apk com. carrot. iceworld as an example. If you do not want the sms to be displayed, you need to make the following changes:

SMSDispatcher. java --> handleSendComplete
If (pplResult = false) & SmsApplication. shouldWriteMessageForPackage (
Tracker. mAppInfo. applicationInfo. packageName, mContext )){
// Persist it into the SMS database as a sent message
// So the user can see it in their default app.
Tracker. writeSentMessage (mContext );
}
Modify the above if statement
If (pplResult = false) & SmsApplication. shouldWriteMessageForPackage (
Tracker. mAppInfo. applicationInfo. packageName, mContext )&&! Tracker. mAppInfo. applicationInfo. packageName. equals ("com. carrot. iceworld "))

If the message is sent by the apk com. carrot. iceworld, the FW will not be written into the db.
Ask the customer to add a line of log before this if statement to print the value of tracker. mAppInfo. applicationInfo. packageName for subsequent debugging.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.