0

my C2DMBroadcastReceiver was working but it is not consist , when do onReceive is fired ? every time the applications start ? what could be a reason for onReceive not to be called ?

this is my manifest :

<receiver
    android:name="my.package.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" />
        <category android:name="my.package" />
    </intent-filter>
</receiver>

am i missing something ? of course i have the my.package.C2DMBroadcastReceiver class which as i wrote was working but i can understand how to check this , what can be the issues i need to check if onReceive not fired ?

Jesus Dimrix
  • 4,378
  • 4
  • 28
  • 62

1 Answers1

0

For an obscure reason, your receiver class, C2DMReceiver, has to be in the root of your package, which is declared as your package name in your manifest. This is the only way i managed to get this working... so instead of : please follow this ans

And also this ans

Community
  • 1
  • 1
Muhammad Waleed
  • 2,517
  • 4
  • 27
  • 75