Google GCM - Do not receive push notifications in android Lollipop

In my Android application, I use GCM to receive messages from my company server.

I wrote code for c2dm, and I followed the instructions for porting the code to GCM. ( http://developer.android.com/google/gcm/c2dm.html )

In android Lollipop (Nexus 9 wifi), the device registers for push notifications and receives the push registration ID, but when I send a message from my server, I do not receive any message on the device.

In previous versions of Android (from 4.0 to 4.4) I had no problems.

Are you aware of any issues with Lollipop push notifications?

thanks

+6
source share
3 answers

We ran into the same problem in our office, so I came across your post here. I tested three separate Nexus 9 devices (WiFi only), and in each case they are all successfully registered for push ... but they never receive any notifications sent from the server.

The first test I used used our existing android application for Android. After that, I was unable to download the Push Notification Test from the Google Play store. This worked flawlessly on other devices (Nexus 5 ... etc.), but did not receive notifications on Nexus 9.

Just for a possible problem with an outdated Play Store Test application, I created a test application for Android and a server script to find out if I can further narrow the problem. I ran into the same problem. Every device under test, with the exception of registered and received Nexus 9 push notifications, I tried to change the version of the Google Play Services library in the project (from the latest version to several versions), but this did not affect.

For my last attempt, mentioned above, I used the GCM demo application found here: GCM Client along with php script I, modified based on a different user code (obviously keys and reg id):

<?php $nexus5 = ''; $nexus9 = ''; $nexus9Alt = ''; $registrationIds = array($nexus5,$nexus9,$nexus9Alt); $apiKey = ''; $msg = array ( 'message' => 'Do you know smell what the rock is cooking?', 'title' => 'Push Test', 'subtitle' => 'This is a subtitle', 'tickerText' => 'This is the ticker', 'vibrate' => 1, 'sound' => 1 ); $fields = array ( 'registration_ids' => $registrationIds, 'data' => $msg ); $headers = array ( 'Authorization: key=' . $apiKey, 'Content-Type: application/json' ); $ch = curl_init(); curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' ); curl_setopt( $ch,CURLOPT_POST, true ); curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers ); curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false ); curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) ); $result = curl_exec($ch ); curl_close( $ch ); echo $result; 

Update . We upgraded the three tablets in the office to 5.0.1 OTA, and tablets will still not receive push notifications. There is no news from Google on them either, but I hope this will be fixed in the next OTA.

Update . On January 13th, we noticed that the Nexus 9 began to receive push notifications. Obviously, Google fixed this. The circle is complete.

+8
source

I have a pretty simple GCM app for Android that works fine on Kitkat. After updating lollypop, an “Explicit Intent” error occurs ( Android 5.0 (L) Intell must be explicit in Google analytics ). I fixed it and there is no error, but there is no device registration!

0
source

I got a solution to this problem by checking the GCM pull notification on the mobile network instead of office WIFI.

0
source

Source: https://habr.com/ru/post/978183/


All Articles