I'm trying to resume an activity from within a broadcast receiver's onReceive()
method as follows:
Intent i = new Intent(context, TimerSet.class);
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
However the activity (TimerSet.class
) is recreated instead of resumed. The only recommended solution I found to this problem was to use the FLAG_ACTIVITY_REORDER_TO_FRONT
but I'm already using it.
Also, using Intent.FLAG_ACTIVITY_NEW_TASK
doesn't fit my use case but I get the following exception when I do not provide it:
android:util.AndroidRuntimeException: Calling startActivity() from outside of an
Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you
want?