Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7024697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:52:33+00:00 2026-05-27T23:52:33+00:00

I have a simple c2dm message receiver class which is called whenever the device

  • 0

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

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?

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?

c2dm message receiver class:

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);
                    }
                }
            }
}

Thanks for any ideas

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:52:33+00:00Added an answer on May 27, 2026 at 11:52 pm

    Add this to your intent

     Intent.FLAG_ACTIVITY_NEW_TASK
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simple test project which creates a frame and adds one JTextPane to
I have simple SSIS package which reads data from flat file and insert into
I have simple SSIS package in which On Error event handler I have created
I have simple CI (CodeIgniter) code. what I want to do is: when I
I have simple Perl/CGI scripts based web server which is mainly used to display
I have simple JSF2 application running on glashfish 3.1. I want to add a
I have simple chat program using WCF service. One service use for server and
I have simple scenario in which i hide and show a signle MenuItem in
I have simple user registration form. In which i am puting city as a
I have simple front controller plugin which contains this code: http://pastebin.com/m155c59b0 When session expire

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.