Hello,

I am trying to start an Activity (say A) from BroadcastReceiver
onReceive method. Most of the time activity (A) is started as expected
but some times Activity (B) is displayed which is already in the
background (last shown activity). Not sure why Activity B is being
displayed instead of Activity A. Am I doing something wrong ? I have
registered BroadcastReceiver in the Android manifest xmll file.

Here is code

    @Override
    public void onReceive(Context context, Intent intent) {
      Log.d(TAG, "onReceive");
      Intent startIntent = new Intent( context, Activity_A.class);
      startIntent.addFlags(Intent.FLAG_FROM_BACKGROUND);
      startIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);   //
Added
      startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      context.startActivity(startIntent);
    }

Any help to resolve this issue would be very most appreciated.

Thanks,

-- 
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