Anybody can help me for this issue?

Thanks,

Stanley

On Jan 23, 10:55 pm, "Stanley.lei" <[email protected]> wrote:
> Hi all,
>
> I am trying to implement an application to send multiple messages one
> by one using the API function  sendTextMessage. As described in SDK
> document, I created two PendingIntent as the last parameters:
> sentIntent and deliveryIntent to send back which message has been sent
> or delivered. But to our surprise, we could only receive the last
> message's sent and delivery status, and all previous status are lost.
>
> The detailed code is as following:
>
> mSentCount = 1;
> while (mSentCount <= mMOCount) {
>         if (!mStarted)
>                 return;
>         // send the message
>         Log.i(StabilityTest.LOG_TAG,
>                         String.format("sent sms %d starting...", mSentCount));
>         Intent sentIntent = new Intent();
>         sentIntent.putExtra(SMS_SENT_KEY_ID, mSentCount);
>         sentIntent.setAction(ACTION_SMS_SENT);
>         Intent deliverIntent = new Intent();
>         deliverIntent.putExtra(SMS_SENT_KEY_ID, mSentCount);
>         deliverIntent.setAction(ACTION_SMS_DELIVER);
>         PendingIntent sentPendingIntent =
>                 PendingIntent.getBroadcast(this, 0, sentIntent,
> PendingIntent.FLAG_CANCEL_CURRENT);
>         PendingIntent deliverPendingIntent =
>                 PendingIntent.getBroadcast(this, 0, deliverIntent,
> PendingIntent.FLAG_CANCEL_CURRENT);
>         String content = String.valueOf(mSentCount) + ": " + mSMSContent;
>         SmsManager.getDefault().sendTextMessage(mPhoneNumber,
>                         null, content,
>                         sentPendingIntent, deliverPendingIntent);
>
>         // sleep interval
>         try {
>                 Thread.sleep(mSentInterval * 1000);
>         } catch (InterruptedException e) {
>                 e.printStackTrace();
>         }
>
>         if (mSentCount == mMOCount)
>                 break;
>         else {
>                 mSentCount++;
>         }
>
> }
>
> And I also implement a BroadcastReceiver to receive the PendingIntent:
>
> public class MOSMSResultReceiver extends BroadcastReceiver {
>         @Override
>         public void onReceive(Context context, Intent intent) {
>                 Log.d(StabilityTest.LOG_TAG, String.format("new MO result 
> coming:
> %s", intent.getAction()));
>                 if (intent.getAction().equals(ACTION_SMS_SENT)) {
>                         notifyResult(intent, SMS_NOTIFY_SENT_SUCC);
>                 }
>                 else if (intent.getAction().equals(ACTION_SMS_DELIVER)) {
>                         notifyResult(intent, SMS_NOTIFY_DELIVERY_SUCC);
>                 }
>         }
>
> }
>
> When the receiver receives an intent, it will judge what the type of
> intent is, and notify GUI to update the status.
>
> I have tried to increase the interval mSentInterval  between two
> messages, and the sent/delivery result could receive more times.
>
> From the observation, it seems that Android ignores many events when
> the events of same kinds are flooding in system. My question is how to
> resolve this issue?
>
> Any reply will be appreciated.
>
> Thanks,
>
> Stanley
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to