Skip to content Skip to sidebar Skip to footer

I Can't Start An Activity From A Broadcast Receiver

I have a broadcast receiver from which, when it receives an intent, I would like to start/resume an activity. Up to point to start the activity everything works fine, I get the int

Solution 1:

Intent intent = newIntent(webviewcontext,WebViewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
webviewcontext.startActivity(intent);

Solution 2:

It turns out that the problem was the context.

The following works:

webviewcontext = context.getApplicationContext();

(context is the context I get from onReceive)

Post a Comment for "I Can't Start An Activity From A Broadcast Receiver"