sms gateway character Limited for 160

Cash Zhu4 years ago

Hi there
I just try to send more txt for sms gateway, but only got limited for
character only can send 160 character, so any way can make more character,
because want i want put map link in sms.
Thanks

Anton Tananaev4 years ago

We don't have any limitations in Traccar.

Cash Zhu4 years ago

Hi Anton Thank you for reply
I means is SMS Gateway. the app for mobile
Thanks

Cash Zhu4 years ago

Hi Anton
I did some investigation and found that the Android system of SMS has a limit of 160 characters. If we need send long sms, we need to send SMS in a special way, such as sendMultipartTextMessage.

if (message.length() > 70) {
    ArrayList<String> msgs = sms.divideMessage(message);
    ArrayList<PendingIntent> sentIntents =  new ArrayList<PendingIntent>();
    for(int i = 0;i<msgs.size();i++){
       sentIntents.add(sentPI);
    }
    sms.sendMultipartTextMessage(phoneNumber, null, msgs, sentIntents, null);
} else {
     sms.sendTextMessage(phoneNumber, null, message, sentPI, deliverPI);
}

but i don't know where i can put in....

Anton Tananaev4 years ago

Feel free to send a pull request if you manage to implement it.