Android Question send multipart SMS but as ASCII not unicode

mirekk36

Member
Licensed User
Longtime User
I know this great function from Erel:

B4X:
Sub SendLargeSms(Destination As String, Message As String)
   Dim r As Reflector
   r.Target = r.RunStaticMethod("android.telephony.SmsManager", "getDefault", Null, Null)
   Dim parts As Object
   parts = r.RunMethod2("divideMessage", Message, "java.lang.String")
   r.RunMethod4("sendMultipartTextMessage", _
      Array As Object(Destination, Null, parts, Null, Null), _
      Array As String("java.lang.String", "java.lang.String", _
         "java.util.ArrayList", "java.util.ArrayList", "java.util.ArrayList"))
End Sub

but the problem is that, this divide EVERY SMS for parts with MAX 72 unicode characters.

So the question is - how to send multipart SMS as simple ASCII characters, not unicode characters ?
 
Last edited:

udg

Expert
Licensed User
Longtime User
Hi, did you try with an ASCII-only message?
Reading "android.telephony.SmsManager" I can't find a reference to Unicode so it could work as-is with ASCII too.
You could even prepare the parts array yourself not relying on divideMessage function. (parts is an ArrayList).
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
but the problem is that, this divide EVERY SMS for parts with MAX 72 unicode characters
https://developer.android.com/reference/android/telephony/SmsManager.html
The point is that
ArrayList<String> divideMessage(String text)
Divide a message text into several fragments, none bigger than the maximum SMS message size.
return 72 if you are sending Unicodecaracters.
Just send only a-z, A-Z, 0-9 and the splitted messages should be 144 or so....

ETA: The problem is maybe Android. I think a String in Java is Unicode...
 
Upvote 0
Top