How call an Intent switch from a c2dm message reciever
<p>I have a simple c2dm message receiver class which is called whenever the device receives a c2dm message.  In one case, I want to have the message receiver class perform an intent switch to load a different activity. Android throws an exception when this happens</p>

<pre><code>01-07 02:28:52.480: E/AndroidRuntime(440): Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
</code></pre>

<p>I guess I could investigate this flag suggested in the exception, but i'm wondering if maybe i'm taking the wrong approach and there is a better way to do this?</p>

<p>c2dm message receiver class:</p>

<pre><code>public class C2DMMessageReceiver extends BroadcastReceiver {
    @Override
            public void onReceive(Context context, Intent intent) {
                String action = intent.getAction();
                Log.w("C2DM", "Message Receiver called");
                if ("com.google.android.c2dm.intent.RECEIVE".equals(action)) {
                    Log.w("C2DM", "Received message");
                    final String payload = intent.getStringExtra("payload");
                    Log.d("C2DM", "dmControl: payload = " + payload);

                    // Message handling
                    if(payload.equals("RdyRoom::join")) {
                        Intent rIntent = new Intent(context.getApplicationContext(), ReadyRoomActivity.class);
                        context.startActivity(rIntent);
                    }
                }
            }
}
</code></pre>

<p>Thanks for any ideas</p>
