Android Support send empty SMS

Source: Internet
Author: User

Method
A) AP-Side Modification:
1, the Composemessageactivity.java in the ispreparedforsending () for the following changes (deleted code can also be commented out)
Private Boolean ispreparedforsending () {
if (isrecipientseditorvisible ())
{
String Recipienttext = Mrecipientseditor.gettext () ==null? ": Mrecipientseditor.gettext (). toString ();
Return msimcount>0 &&! Textutils.isempty (Recipienttext);
}else{
Return msimcount>0;
}
}
2, add in the Smssinglerecipientsender.java
Import Android.text.TextUtils;
And in the function public boolean sendMessage (long token, int simid), "int messagecount = Messages.size ();" Before joining
if (Textutils.isempty (Mmessagetext)) {
Messages.add ("");
}
3, Smsmessagesender.java Modify the Queuemessage () method
Remove the judgment on the Mmessagetext==null.

B) The changes in the framework end need to be Patch,patch are as follows:
Alps\mediatek\frameworks-ext\base\telephony\java\android\telephony\gemini\geminismsmanager in the
Isvalidparameters (String destinationaddress, string parts, Pendingintent sentintent) method,
Remove the part of this method that parts is empty.
if (Parts==null | | parts.size () <1) {
throw new IllegalArgumentException ("Invalid message body"); <---block this statement
}

In addition, if the screen in the case of receiving information, this time the information directly show, I hope in the dialogmodeactivity this interface can also support the reply to empty text messages, in addition to the above changes, but also need to modify the following code:
This document will be Dialogmodeactivity.java to make the following changes:
1. Modify the private void Updatesendbuttonstate () {Approximately 2242 lines, and modify the IF (len>0) to if (len>=0), as follows:
private void Updatesendbuttonstate () {
Boolean enable = false;
int len = Mreplyeditor.gettext (). toString (). Length ();
MMSLOG.D (TAG, "Dialogmodeactivity.updatesendbuttonstate (): len =" + len);
if (Msendbutton! = null) {
if (len >= 0) {//Modify for send blank SMS
MMSLOG.D (TAG, "updatesendbuttonstate (): Msimcount =" + Msimcount);
2. Modification:
Onpremessagesent () {
MMSLOG.D (TAG, "dialogmodeactivity.onpremessagesent");
if (muris!= null &&!muris.isempty ()) {
Runonuithread (mresetmessagerunnable);
}

3. Runnable mresetmessagerunnable = new Runnable () {
public void Run () {
if (muris!= null &&!muris.isempty ()) {
MMSLOG.D (TAG, "Mresetmessagerunnable.run");
Resetmessage ();
}
}
};
Note: For the KK version of the phone, the modification method changes slightly, the change is mainly two points:
1.smsmessagesender.java Modify the Queuemessage () method to remove the judgment of Messagetext==null ====>
Smsmessagesender.java Modify the Queuemessage () method to remove the pair (Mmessagetext = = null) | | The Judgment of Mmessagetext.isempty ()
2.geminismsmanager.java KK does not have this file, change ===>
Packages/apps/mms/src/com/mediatek/encapsulation/android/telephony/gemini/encapsulatedgeminismsmanager.java
Frameworks/opt/telephony/src/java/android/telephony/smsmanager.java
Mediatek/frameworks/opt/telephony/src/java/com/mediatek/telephony/smsmanagerex.java
Modification method with JB:
if (Parts==null | | parts.size () <1) {
throw new IllegalArgumentException ("Invalid message body"); <---block this statement
}

Android Support send empty SMS

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.