StartActivity within BroadcastReceiver

0

I want to go to another activity when I enter the onReceive of my receiver, but it always stops working in startActivity , the code I'm doing is like this:

@Override
public void onReceive(Context context, Intent intent) {
    Toast.makeText(context, "Hora de ir", Toast.LENGTH_LONG).show();
    Intent i = new Intent(context, MyAlarmService.class);
    context.startActivity(i);
}
    
asked by anonymous 28.05.2014 / 15:34

1 answer

1

Required to add FLAG_ACTIVITY_NEW_TASK.

    
28.05.2014 / 15:46