1

I am sending a text (Encrypted text) from one android device to another but while receiving I am getting only part of text.

1.

Text I am sending: O34S/6hQqmbsYeWPVqZK/g==]wwOyeaKvTvV5ytoxGri1kj96jDIukzu45je+U822TM=

Text I am receiving: O34S/6hQqmbsYeWPVqZK/g==] e e =

2.

Text I am sending: B+zbCj1D2DcMO1/j9131TA==]zh5sYADg0v8liAZJjEefik52czrwpNlhZ5VgAMU=

Text I am receiving: B+zbCj1D2DcMO1/j9131TA==] / %

It seems that after "]" the text is trimmed.

Code I am using to send the text

String phoneNo = txtPhoneNo.getText().toString();
            final String sendtext = text_to_send;
            String message = sendtext;                 
            if (phoneNo.length()>0 && message.length()>0)                
                sendSMS(phoneNo, message);  
private void sendSMS(String phoneNumber, String message)
{        
    PendingIntent pi = PendingIntent.getActivity(this, 0,
        new Intent(this, CorporateActivity.class), 0);                
    @SuppressWarnings("deprecation")
    SmsManager sms = SmsManager.getDefault();
    sms.sendTextMessage(phoneNumber, null, message, pi, null);        
}
tausif
  • 672
  • 1
  • 6
  • 15
  • Yes it is happening because of "]" (delimiter).The above code is not sending anything after "]".How to resolve this? – tausif May 07 '14 at 12:49
  • Just send some text that starts with a ]. Please put "send text with sms" in the subject of your post. – greenapps May 07 '14 at 13:12
  • Done.Yes i tried sending a text that start with ] but i received only "]" .I didn't received the text after ].For example i tried to send "]Hello".I received only "]". – tausif May 07 '14 at 13:37
  • Think that the ] is not in your normal charset. WIth a ] it becomes unicode. You have to use sendMultipartTextMessage instead of sendTextMessage. Please try. – greenapps May 07 '14 at 13:40
  • I will try it.Sorry for the earlier post.I will delete it. – tausif May 07 '14 at 13:46
  • Its not working.I tried to send "hello]check this".I received "hello] e" – tausif May 07 '14 at 14:08
  • Did you read: http://stackoverflow.com/questions/4233461/android-unicode-charset-problems-when-sending-an-sms-sendtextmessage – greenapps May 07 '14 at 14:15
  • For the time beeing you could encode your message base64 before sending. – greenapps May 07 '14 at 14:18
  • I replaced "]" with "*" while sending and did reverse when i received it.Thank yo @greenapps for your help. – tausif May 07 '14 at 15:18

1 Answers1

0

I found this solution there:

It may be useful to look at how gTalkSMS handles incoming SMS'es, as it appears to handle multipart messages correctly.

Community
  • 1
  • 1
Iman Marashi
  • 5,593
  • 38
  • 51