user1623454
user1623454

Reputation: 284

Not getting android push notification messages from gcm

I am developing an android application with push notification using GCM (step by step: http://developer.android.com/google/gcm/index.html) but not all devices getting notifications from GCM server.

I debugged it and I saw that my 3d-party server sends the message successfully.

When i send to my Galaxy-S4 device I get the notification but in my Galaxy-S2 i don't get.

AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<permission android:name="com.example.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" />

<receiver
        android:name=".gcm.GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
             <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="com.freco" />
        </intent-filter>
    </receiver>
    <service android:name=".gcm.GcmIntentService" />

I think the other code its not necessary here because its works fine in Galaxy-S4.

What do you think is it ?

Upvotes: 2

Views: 3735

Answers (2)

Chad Bingham
Chad Bingham

Reputation: 33846

Looks like a copy paste error. In your manifest, change com.example to your actual package name

Upvotes: 0

Eran
Eran

Reputation: 393771

What's the package of your app, com.freco (as defined in the category of the broadcast receiver) or com.example.gcm (as defined in your permissions)?

You should use the package name of your app in both places. For some reason, this mismatch only causes problems in older Android versions. Newer versions work either way.

Upvotes: 1

Related Questions