]> iEval git - fonbot.git/commitdiff
Split text messages in sendMessage
authorMarius Gavrilescu <marius@ieval.ro>
Tue, 19 Aug 2014 21:08:13 +0000 (00:08 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Tue, 19 Aug 2014 21:08:13 +0000 (00:08 +0300)
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

index ce275fab8c325e224f91b0361252fbec93002df4..be7923ba5694d7c1eb169c0eb649fc9cfad8f4cc 100644 (file)
@@ -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<String> parts = SmsManager.getDefault().divideMessage(message);
+                                               SmsManager.getDefault().sendMultipartTextMessage(address.data, null, parts, null, null);
                                        }
                                });
                        break;
This page took 0.022674 seconds and 4 git commands to generate.