3

I am working on app, i am using intent to launch sms activity. I set the sms_body of the intent, after a while i changed the text of sms_body and recepients too but now when i launch the sms activity it show old text and old recepients.

I even clean the project. I debug as well, the values are setting correctly, but on activity launch it shows old text and recepients.

EDIT:

when i do the following code:

                    Intent intent = new Intent(Intent.ACTION_VIEW); 
                    String primaryandsecondaryNumbers=PrimaryNumber+";"+SecondaryNumber;

                    String messageBody="MY MESSAGE";
                   intent.putExtra("address", primaryandsecondaryNumbers);
                  intent.putExtra("sms_body", messageBody);
                  intent.setData(Uri.parse("smsto:" + primaryandsecondaryNumbers));
                  intent.setType("vnd.android-dir/mms-sms");
                  startActivity(intent);

My messageBody is not updated but recepient numbers are set.

and when i comment:

         intent.putExtra("address", primaryandsecondaryNumbers);

my message is updated, but my numbers are not visible

Najeebullah Shah
  • 4,164
  • 4
  • 35
  • 49

2 Answers2

2

This happens because of the draft saved for the recepient. If you change recepient and draft is not exist for him then it set new message. If you delete a draft that will work.

chek
  • 31
  • 2
  • 6
0

I had this issue with the HTC Sensation. The only way to construct the intent and get everything updated correctly is by using this:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.putExtra("address", "123456");
intent.putExtra("sms_body", "Message Body");
intent.setData(Uri.parse("smsto:123456")); //yes, you need the number twice
activity.startActivity(intent);
Tas Morf
  • 3,065
  • 1
  • 12
  • 8