简体   繁体   中英

push notifications are not received in my android device from gcm?

Hi In my project I added gcm notification services and followed developers official page.I sent device registration id to server my key also saved in server.And my server sends notification to gcm server at that time server i get success message .But i didn't get any push notifications to my device.Please provide any suggestions. Thanks in advance

and in my logcat showing this message

GCMBroadcastReceiver: onReceive: com.google.android.c2dm.intent.RECEIVE
GCMBroadcastReceiver: GCM IntentService class: com.example.GCMIntentService
GCMBaseIntentService: Acquiring wakelock

this is my manifest with all other permissions

 <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.example" />
        </intent-filter>
    </receiver>       
    <service android:name=".GCMIntentService" />

I had same problem of receiving push messages, even though GCM server replies "Success", because of wifi privacy. When I used my company wifi, I coudn't receive message in mobile, since they were blocked GCM server port . So, even your wifi also could be a one of the reason. check it once { this answer is for others , who may face this}

can you please check in your device did you login in gmail account?

if you are not logged in you will not get push notification.

first login in gmail then then try may be it will work.

确保你在主包中有GCMIntentService.class接收来自GCM服务器的广播(更喜欢与GCM相关的任何东西在主包中)我希望这项工作

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