From 0bcf6b2e55caca54187c6011eaa174297480731e Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Wed, 20 Aug 2014 00:08:13 +0300 Subject: [PATCH] Split text messages in sendMessage This way messages longer than 140 characters are sent correctly instead of being discarded. Thanks to Valerio Bozzolan for reporting bug 11. --- src/ro/ieval/fonbot/Utils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ro/ieval/fonbot/Utils.java b/src/ro/ieval/fonbot/Utils.java index ce275fa..be7923b 100644 --- a/src/ro/ieval/fonbot/Utils.java +++ b/src/ro/ieval/fonbot/Utils.java @@ -4,6 +4,7 @@ import static ro.ieval.fonbot.R.string.*; import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.Arrays; import java.util.Locale; @@ -302,7 +303,8 @@ public final class Utils { new Handler(Looper.getMainLooper()).post(new Runnable(){ @Override public void run(){ - SmsManager.getDefault().sendTextMessage(address.data, null, message, null, null); + final ArrayList parts = SmsManager.getDefault().divideMessage(message); + SmsManager.getDefault().sendMultipartTextMessage(address.data, null, parts, null, null); } }); break; -- 2.39.2