How to send long SMS in Android?
I'm using RSA Encryption with a key of 1024bit , the ciphered text's length will be more than 160 bytes , and on sending an SMS of more than 160bytes it gives exception and after using sendmultisms() and divide the message , at the 开发者_StackOverflow中文版receiver side gets unprintable characters and also I will have a problem of how to concatandenate the SMSs.
You could use data-sms which supports true 8bit, whereass a normal sms only takes 7bit. This is why you get garbage on the other side without any further encoding efforts.
You can also encode the ciphered text using Base64 encoding, break it up the into an ArrayList of Strings and use sendMultipartTextMessage. It then sends as many SMS as needed.
SmsManager sms = SmsManager.getDefault();
ArrayList<String> parts = sms.divideMessage(base64EncodedMessage);
sms.sendMultipartTextMessage(phoneNumber, null, parts, null, null);
精彩评论