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 6883507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:23:32+00:00 2026-05-27T05:23:32+00:00

I have one question about C2DM, I registered yesterday and I got email that

  • 0

I have one question about C2DM, I registered yesterday and I got email that my mail and app are approved. From app I get registration_id, I have broadcast_receiver like

@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();

    android.util.Log.d("REG_1","onReceive");


    if ("com.google.android.c2dm.intent.REGISTRATION".equals(action)) {
        final String registrationId = intent
                .getStringExtra("registration_id");
        String error = intent.getStringExtra("error");

        android.util.Log.d("REG_1",registrationId);

        SharedPreferences prefs = PreferenceManager
                .getDefaultSharedPreferences(context);
        String token = prefs.getString("token", null);
        String userId;
        try {
            userId = RestClient.getUserIdByToken(token).getString(
                    "user_id");

            Intent i = new Intent(context, RegService.class);
            i.putExtra("c2dm_registration_id",registrationId);
            i.putExtra("token", token);
            i.putExtra("user_id", userId);
            i.putExtra("device_id", "bla");
            i.setAction(android.content.Intent.ACTION_VIEW);
            context.startService(i);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }



        saveRegistrationId(context, registrationId);
    }

and I enter in this function during registration and I send messages from command line like

curl https://www.google.com/accounts/ClientLogin -d Email=MYGOOGLEACCOUNT@gmail.com -d "Passwd=MY_PASSWORD" -d accountType=GOOGLE -d source=Google-cURL-Example -d service=ac2dm

and

curl --header "Authorization: GoogleLogin auth=DQAAAMMAAAC58D4X-5zjQFdYuGz7D9DhnuN4OUiz_gCtOJRSNwNLN0-wxveAEVL985hNKJXyQ_7U4sTfsUGh_3OXMLKpB5PNN1eaI4AfT19LaJ1vGJCZ_sSE0NDqGsC0mZVdMsYbE2Sz1r1WE_p5WNokfGMRdmxIHl0QCWb43lTD3iCvr51ujmnHnvpn2mDLWr6j9DtyDxADRw1to2iGgpJNelXmIA8tOzjyqF3szN-N2IYnihJ8H2t3G5wotOWy1EahB43Lv2NPdlV-A4yVSbdsYGM_AVdd" "https://android.apis.google.com/c2dm/send" -d registration_id=APA91bHhbsPedDVnYCaSJQMhWjfjK3W9jOaMgVITUHqw97w4fF_8fermSG22CzFvpPuTyRKnJFyJ_iwfgJEJ4uidURxuHZCCBuPtGAsv6NeVipmOd53Fkru_A3NW3cpIMo9gvuVxIB0QqxOvl1SmVfqRzD4qQfSNaw -d "data.test_result=This data will be send to your application as payload" -d collapse_key=2
id=0:1322216144957968%b3c4048a00000032

but it never enter in onHandle function of broadcatreceiver.

    <receiver
        android:name="com.surveyce.android.c2dm.C2DMRegistrationReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter >
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="com.surveyce.android" />
        </intent-filter>
        <!-- Receive the registration id -->
        <intent-filter >
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="com.surveyce.android" />
        </intent-filter>
    </receiver>

…

    <uses-sdk android:minSdkVersion="8" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!--<uses-permission android:name="android.permission.WAKE_LOCK" />-->
    <uses-permission android:name="com.surveyce.android.permission.C2D_MESSAGE" />
    <permission
        android:name="com.surveyce.android.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
        <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

Did anybody have similar strange problems that get registrationId and send messages but do not receive message on phone ? What can be problem, maybe because I registered yesterday ( but how than I get rigistrationId and auth for that account) ? Package names and gmail are account are 100% ok.

  • 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-27T05:23:32+00:00Added an answer on May 27, 2026 at 5:23 am

    Add a service tag [write your receiver name in below service tag which is sub class of C2DMBaseReceiver]

    <service android:name=".C2DMReceiver" />
    

    Use C2DMBroadcastReceiver Instead of C2DMRegistrationReceiver

    <receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
                android:permission="com.google.android.c2dm.permission.SEND">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just have one simple question about XSS attack. I know that you can
I have one question about the short data type in Java. I know that
I have one question about LINQ, I dont know how to get the result
I have one question about sys.setrecursionlimit() From the python docs this function: Set the
i have one question about jquery ajax().. I created a table grid and there
I have one question about searching and counting files in directories and subdirectories. I
I have one question about Yii framework, and I need your help. Basicly, I
Ok, i have one totaly noob question about php sessions: I have 3 (and
I have a question about Criteria method, one-to-many relation to the database, 'one' is
I have another one question about functions reference. For example, I have such definition:

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.