Android Question sendsms send only text with english characters

kalarius

Active Member
Licensed User
Longtime User
B4X:
Sub Activity_Create(FirstTime As Boolean)
mySms.Send("XXXXXXXX","mhchanh katametrhshs kermatvn 140e +fpa kainoyrgia" & CRLF & " kalarakis Michalis ")
mySms.Send("XXXXXXXXX","Μηχανη καταμετρησης κερματων 140ε +φπα καινουργια" & CRLF & " kalarakis Michalis ")

end sub



I set the permission form the option of my telephone
So i have permission for sms
it is the option from the telephone.

I do not have problem with permissions because this small code send sms
this line send the sms
mySms.Send("XXXXXXXX","mhchanh katametrhshs kermatvn 140e +fpa kainoyrgia" & CRLF & " kalarakis Michalis ")
the text is at english character set.

but at the line with greek character doe not send sms and NO errors
mySms.Send("XXXXXXXXX","Μηχανη καταμετρησης κερματων 140ε +φπα καινουργια" & CRLF & " kalarakis Michalis ")


every time I run the program (debug) it sent the sms with english characters but not the sms with greek.

* Also if the greek text lenght is 70 characters long it send it
** the telephone application can sent messages with length of 150 character (greek or english)

I have ver 8.50 for B4A android 28 and at the manager android 26
telephone xiaomi redmi note 5a android ver 7.2.1N2G47H
 
Last edited:

udg

Expert
Licensed User
Longtime User
If I recall it correctly, non-standard chars take two positions (maybe more for some subset). Tyis happens with latin accented letters too.
Sorry to be short on my response hut I am using a very small virtual keyboard.
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Doubt that troubles are relative to a code.
Your sample works fine on my phone. I also tried Java-code (see bellow). Also works.

Meanwhile XIOMI phones have very specific phone settings.
Did you look SMS settings ? May be there is a flag "Use GSM alphabetic" (means 7-bit encoding) or something like this.

Additianal sample, which I tried.
Add inline Java code

B4X:
#If Java
import android.telephony.SmsManager;
import android.content.Intent;
import android.app.PendingIntent;
import android.provider.Telephony.Sms.Intents;
import android.provider.Telephony.Sms.Sent;
import java.util.ArrayList;

public void sendSms (String phonenumber, String message)
{
    int MAX_SMS_MESSAGE_LENGTH = 70;
    SmsManager manager = SmsManager.getDefault();

    PendingIntent piSend = PendingIntent.getBroadcast(this, 0, new Intent("SMS_SENT"), 0);
    PendingIntent piDelivered = PendingIntent.getBroadcast(this, 0, new Intent("SMS_DELIVERED"), 0);

    int length = message.length();

    if (length > MAX_SMS_MESSAGE_LENGTH)
    {
        ArrayList <String> messagelist = manager.divideMessage(message);

        manager.sendMultipartTextMessage(phonenumber, null, messagelist, null, null);
    }
    else
    {
        manager.sendTextMessage(phonenumber, null, message, piSend, piDelivered);
    }
}
#End If

and call using

B4X:
Dim jo As JavaObject
    jo.InitializeContext
    jo.RunMethod ("sendSms", Array ("*************", "Μηχανη καταμετρησης κερματων 140ε +φπα καινουργια" & CRLF & " kalarakis Michalis "))
 
Last edited:
Upvote 0
Top