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

  • Home
  • SEARCH
  • 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 6797625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:37:54+00:00 2026-05-26T18:37:54+00:00

I’m having some trouble implementing C2DM registration. My BroadcastReceiver is never called. I’m working

  • 0

I’m having some trouble implementing C2DM registration. My BroadcastReceiver is never called.

I’m working with the emulator (Google APIs (Google Inc.) – API Level 8) with my gmail account set up. It seems to work because the BroadcastReceiver of the Thomas Malmsten exemple is working fine on my emulator (link).

Here is my manifest :

<permission android:name="my.package.permission.C2D_MESSAGE" android:protectionLevel="signature"></permission>
<uses-permission android:name="my.package.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
<uses-sdk android:minSdkVersion="8" />

<application android:name=".utils.MyApp" ...>

   <receiver android:name=".C2DMBroadCastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
      <!-- Receive the actual message -->
      <intent-filter>
          <action android:name="com.google.android.c2dm.intent.RECEIVE" />
          <category android:name="my.package" />
      </intent-filter>
      <!-- Receive the registration id -->
      <intent-filter>
          <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
          <catemgory android:name="my.package" />
      </intent-filter>
  </receiver>

    <activity android:name=".views.LoginScreen" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <!-- lots of activities -->
    <!-- lots of services -->

</application>

For now, I just want to write something in the logcat.

My Broadcast Receiver
package my.package;

import ...;

public class C2DMBroadCastReceiver extends BroadcastReceiver {

    @Override
    public final void onReceive(Context context, Intent intent) {
        Log.d("C2DMBroadCastReceiver ", "Received something from Google.");
        if (intent.getAction().equals("com.google.android.c2dm.intent.REGISTRATION")) {
            Log.d("C2DMBroadCastReceiver ", "Received a registration ID from Google.");
        } else if (intent.getAction().equals("com.google.android.c2dm.intent.RECEIVE")) {
            Log.d("C2DMBroadCastReceiver ", "Received a C2DM message from Google.");
        }
    }
}

Here is my registration fonction :

Context context = MyApp.getAppContext();
            Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
            registrationIntent.putExtra("app", PendingIntent.getBroadcast(context, 0, new Intent(), 0)); 
            registrationIntent.putExtra("sender", "myC2DMaddress@gmail.com");
            Log.w("Register", "Intent to register");
            context.startService(registrationIntent);

Finaly, the logcat :

W/Register(  344): Intent to register
I/ActivityManager(   58): Starting activity: Intent { cmp=my.package/.views.Conver
sationList }
D/GoogleLoginService(  173): onBind: Intent { act=android.accounts.AccountAuthen
ticator cmp=com.google.android.gsf/.loginservice.GoogleLoginService }
D/dalvikvm(  173): GC_FOR_MALLOC freed 4630 objects / 378200 bytes in 133ms
D/dalvikvm(  344): GC_FOR_MALLOC freed 1799 objects / 279192 bytes in 95ms
D/NativeCrypto(  344): Freeing OpenSSL session
I/ActivityManager(   58): Displayed activity my.package/.views.ConversationList: 1
352 ms (total 1352 ms)
D/dalvikvm(  344): GC_EXTERNAL_ALLOC freed 2170 objects / 476328 bytes in 90ms
D/dalvikvm(  344): GC_FOR_MALLOC freed 6985 objects / 461360 bytes in 151ms
D/dalvikvm(  344): GC_FOR_MALLOC freed 612 objects / 32376 bytes in 153ms
I/dalvikvm-heap(  344): Grow heap (frag case) to 3.239MB for 87396-byte allocati
on
D/dalvikvm(  344): GC_FOR_MALLOC freed 24 objects / 1736 bytes in 51ms
D/dalvikvm(  344): GC_FOR_MALLOC freed 0 objects / 0 bytes in 146ms
I/dalvikvm-heap(  344): Grow heap (frag case) to 3.321MB for 87396-byte allocati
on
D/dalvikvm(  344): GC_FOR_MALLOC freed 0 objects / 0 bytes in 53ms
D/NativeCrypto(  344): Freeing OpenSSL session
D/dalvikvm(  344): GC_FOR_MALLOC freed 1080 objects / 244032 bytes in 122ms
I/global  (  344): Default buffer size used in BufferedReader constructor. It wo
uld be better to be explicit if an 8k-char buffer is required.
D/dalvikvm(  344): GC_FOR_MALLOC freed 1077 objects / 120272 bytes in 53ms
I/dalvikvm-heap(  344): Grow heap (frag case) to 3.506MB for 87396-byte allocati
on
D/dalvikvm(  344): GC_FOR_MALLOC freed 375 objects / 24096 bytes in 52ms
D/dalvikvm(  344): GC_FOR_MALLOC freed 3 objects / 104 bytes in 49ms
I/dalvikvm-heap(  344): Grow heap (frag case) to 3.567MB for 87396-byte allocati
on
D/dalvikvm(  344): GC_FOR_MALLOC freed 0 objects / 0 bytes in 146ms
D/dalvikvm(  344): GC_FOR_MALLOC freed 1 objects / 16 bytes in 49ms
I/dalvikvm-heap(  344): Grow heap (frag case) to 3.733MB for 87396-byte allocati
on
D/dalvikvm(  344): GC_FOR_MALLOC freed 0 objects / 0 bytes in 146ms
I/global  (  344): Default buffer size used in BufferedReader constructor. It wo
uld be better to be explicit if an 8k-char buffer is required.

Sorry about all the code, but i really don’t know what’s going on!

Thank you,
Matthieu

ps : It’s not working either with a Nexus One.

  • 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-26T18:37:54+00:00Added an answer on May 26, 2026 at 6:37 pm

    Really stupid mistake : catemgory instead of category in the manifest.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.