简体   繁体   中英

Not getting push notification from GCM eventhough response is success

I want push notification by using GCM, all things are done properly, like API key & others.

I'm getting following success message, but not getting notification on mobile(device id is also proper, also tried on different divices)

 {"multicast_id":6811225836747189127,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1395652805845432%ae8ef3eff9fd7ecd"}]}

May I know what is the correct way to achieve my objective? Thanx in advance

manifest code``

<permission android:name="com.demo.permission.C2D_MESSAGE" android:protectionLevel="signature" />

<uses-permission android:name="com.demo.permission.C2D_MESSAGE" />

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />  <receiver
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>

            <!-- Receives the actual messages. -->
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <!-- Receives the registration id. -->
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="com.demo" />
        </intent-filter>
    </receiver>

    <service android:name="com.demo.GCMIntentService" />                    ``

I faced same problem. You should check your "send id" should be something like this in your code:

String SENDER_ID = "1090629393827";

that number is your project id.

...Also try to allow any IP on your google project page and check your API Key. For some reaseon sending data trought a browser i had to use the BROWSER API KEY no the SERVER API KEY .

and finally if you are using a emulator check you firewall setting!

sorry for my english it's not my first language.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM