1

I'm developing an android application that sends an sms message from a window (Activity) then moves to another window(Activity). I'm trying to display a message to the user how is seeing another activity that the message is delivered. I imagine the solution would be to it fire a thread that send the message and and wait until it's delivered and show a toast or Dialog. but I don't know if it's right or how to do that. pls help.

aladein
  • 125
  • 3
  • 12

2 Answers2

1

sendDataMessage has following parameters for that:

sentIntent - if not NULL this PendingIntent is broadcast when the message is sucessfully sent, or failed.

deliveryIntent - if not NULL this PendingIntent is broadcast when the message is delivered to the recipient.

[edit] - example how to create pending intent

final PendingIntent sentIntent = PendingIntent.getActivity(this, 0, new Intent(this, SmsSendCheck.class), 0);

SmsSendCheck - this is a special activity to show your Toast

George Netu
  • 2,758
  • 4
  • 28
  • 49
marcinj
  • 48,511
  • 9
  • 79
  • 100
0

Toast is a good way. Otherwise, when your PendingIntent was broadcast after SMS was sent, display something in the current Activity.

Yusuf X
  • 14,513
  • 5
  • 35
  • 47
  • thanks for answering pending intent is in other activity. how to display Toast while the work is in another activity – aladein May 15 '12 at 19:01
  • See here for how to do either: http://stackoverflow.com/questions/9511630/smsmanager-and-pending-intent – Yusuf X May 15 '12 at 19:05