How to send the SMS more than 160 character?

后端 未结 4 1430
别跟我提以往
别跟我提以往 2020-11-28 06:26

How to send big SMS in android. I used :

SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(contactNos[j], null,msgs[i], sentPI, deliveredPI);


        
相关标签:
4条回答
  • 2020-11-28 06:59

    The emulator send the junk characters in that code during certain problem so use apk in real mobile , and check the code , I am sure that your application will not send junk message..All the best.

    0 讨论(0)
  • 2020-11-28 07:03

    You should get specific Short Code from SMSC, for sending SMS which having characters more than 160.

    0 讨论(0)
  • 2020-11-28 07:10

    Try below code might help

    SmsManager sms = SmsManager.getDefault();
    ArrayList<String> parts = sms.divideMessage(message);
    sms.sendMultipartTextMessage(phoneNumber, null, parts, null, null);
    
    0 讨论(0)
  • 2020-11-28 07:17

    Junk characters? method sendMultipartTextMessage only send text message. If you want to send non text message, you should look to method sendDataMessage. Below is the code excerpt from android cts. It has example on how to send long messages.

    SmsManager sm = SmsManager.getDefault();
    ArrayList<String> parts =sm.divideMessage(LONG_TEXT);
    int numParts = parts.size();
    
    ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
    ArrayList<PendingIntent> deliveryIntents = new ArrayList<PendingIntent>();
    
    for (int i = 0; i < numParts; i++) {
    sentIntents.add(PendingIntent.getBroadcast(getContext(), 0, mSendIntent, 0));
    deliveryIntents.add(PendingIntent.getBroadcast(getContext(), 0, mDeliveryIntent, 0));
    }
    
    sm.sendMultiPartTextMessage(mDestAddr,null, parts, sentIntents, deliveryIntents)
    
    0 讨论(0)
提交回复
热议问题