On Jul 6, 4:21 pm, Jaap <
jaap.hait...@gmail.com> wrote:
> When I receive a message in my broadcast receiver I want to start an
> activity.
You can use an intent to trigger an activity from a broadcast
receiver. I used the following snippet in my own app:
public void onReceive(Context context, Intent intent) {
Intent startActivity = new Intent();
startActivity.setClass(context, MyActivity.class);
startActivity.setAction(MyActivity.class.getName());
startActivity.setFlags(
Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
context.startActivity(startActivity);
}
A full example is here:
http://code.google.com/p/publicobject/source/browse/shush/src/com/publicobject/shush/OnRingerMuted.java
Cheers,
Jesse