From: Marius Gavrilescu Date: Tue, 19 Aug 2014 21:08:13 +0000 (+0300) Subject: Split text messages in sendMessage X-Git-Tag: 0.000_002~11 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=0bcf6b2e55caca54187c6011eaa174297480731e;p=fonbot.git 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. --- 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;