1

I want to know if it is possible to use Greek or other language characters while sending sms on android. now they look like dwarven or elvish if i use Greek.

String message1 = "Γειά σας";    
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(strPhoneNo, null, message1, null, null);

Actual Code public class IncomingSMSReceiver extends BroadcastReceiver{

private static final String SMS_RECEIVED ="android.provider.Telephony.SMS_RECEIVED";

@Override
public void onReceive(Context _context, Intent _intent) {

    if (_intent.getAction().equals(SMS_RECEIVED)) {
        Bundle bundle = _intent.getExtras();
        if (bundle != null) {

            Object[] pdus = (Object[]) bundle.get("pdus");

            SmsMessage[] messages = new SmsMessage[pdus.length];
            for (int i = 0; i < pdus.length; i++)
                messages[i] = SmsMessage
                        .createFromPdu((byte[]) pdus[i]);
            for (SmsMessage message : messages)
            {
                String strPhoneNo = message.getOriginatingAddress();
                String msg = message.getMessageBody();

                if (msg.startsWith("01"))
                {
                     try {
                         final String[] temaxismeno_sms = msg.split(":");
                         DatabaseHelper dbHelper = new DatabaseHelper(_context.getApplicationContext());
                         //eisagoghfititi(String am,String onoma,String epitheto,String examino,String kinito)
                         dbHelper.eisagoghfititi(temaxismeno_sms[1],temaxismeno_sms[2],temaxismeno_sms[3],temaxismeno_sms[4],strPhoneNo);

                         Toast.makeText(_context, "Έγινε εισαγωγή φοιτητή!!", Toast.LENGTH_LONG).show();

                         String message1 = "Έγινε η εισαγωγή σας στην βάση!";// minima pou tha stalthei
                         SmsManager sms = SmsManager.getDefault();
                         sms.sendTextMessage(strPhoneNo, null, message1, null, null);
                         //Toast.makeText(_context, "Ο Φοιτητής ειδοποιήθηκε", Toast.LENGTH_LONG).show();
                         Toast.makeText(_context, "O etoumenos idopiithike", Toast.LENGTH_LONG).show();
                         }
                    catch (Exception e)
                        {
                        Toast.makeText(_context, "Το SMS Απέτυχε, Παρακαλώ δοκιμάστε ξανά.", Toast.LENGTH_LONG).show();
                            String message1 = "den egine eisagwgh, h swsth morfh einai 01:AM:ONOMA:EPITHETO:EXAMINO";//"Δέν εγινε η εισαγωγή σας στην βάση!Η σωστή μωρφή sms είναι: 01:ΑΜ:ΟΝΟΜΑ:ΕΠΙΘΕΤΟ:ΕΞΑΜΗΝΟ";// minima pou tha stalthei
                            SmsManager sms = SmsManager.getDefault();
                            sms.sendTextMessage(strPhoneNo, null, message1, null, null);
                            Toast.makeText(_context, "O etoumenos idopiithike", Toast.LENGTH_LONG).show();
                        e.printStackTrace();
                        }
                }
Fmetal
  • 35
  • 1
  • 7
  • http://stackoverflow.com/questions/2694500/encoding-sms-messages-in-android – Methnani Bilel May 07 '16 at 00:20
  • Greek characters should work just fine with `SmsManager#sendTextMessage()`. Please post an actual message that you're testing. Also, if you're handling receiving the message, please post that code, as well. – Mike M. May 07 '16 at 00:28
  • added the actual code ! any ideas ? – Fmetal May 07 '16 at 08:34
  • Where exactly in your code is the Greek not coming out correctly? Is it just when you send? Or when you receive, too? Is it not working only in your app, or do you mean it shows up wrong on another device? – Mike M. May 07 '16 at 11:03
  • if i use on a toast it works fine ! when i send with sms on the emulator i get mixed symbols $@#%@%## not normal like this but you get the point – Fmetal May 07 '16 at 15:56
  • Where? Where are these mixed symbols showing up? In your app, or in another app? Anyway, I don't know how the emulator handles SMS, exactly, but I would suggest you test it on a real device. You can always have a device send itself a message, if you only have one to test on. – Mike M. May 07 '16 at 19:50

0 Answers0