mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-27 11:12:16 -05:00
Add support for sending long (multi-part) SMS messages
This commit is contained in:
parent
90952ef4d0
commit
0c97609286
@ -12,6 +12,8 @@ import eu.siacs.conversations.xml.Element;
|
||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||
import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SMSReceiver extends BroadcastReceiver {
|
||||
|
||||
public static final String ECHO_SERVER = "echo.burtrum.org";
|
||||
@ -95,6 +97,10 @@ public class SMSReceiver extends BroadcastReceiver {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
final SmsManager sms = SmsManager.getDefault();
|
||||
final ArrayList<String> parts = sms.divideMessage(message.getBody());
|
||||
if(parts.size() > 1)
|
||||
sms.sendMultipartTextMessage(message.getConversation().getJid().getLocalpart(), null, parts, null, null);
|
||||
else
|
||||
sms.sendTextMessage(message.getConversation().getJid().getLocalpart(), null, message.getBody(), null, null);
|
||||
}
|
||||
}).start();
|
||||
|
Loading…
Reference in New Issue
Block a user