Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid GCM sent successfully but not received on some devices
    primarykey
    data
    text
    <p>On the server side, I am using GCM server 1.0.2 library provided by Google. On the client side, I set up GCM as provided on the <a href="http://developer.android.com/google/gcm/client.html" rel="noreferrer">official documentation</a>.</p> <p>My problem is that everything works fine on most devices, but on few devices, push is not recieved.</p> <pre><code>if (case1) message = new Message.Builder() .timeToLive(0) .collapseKey("0") .delayWhileIdle(false) .addData("msg", msg).build(); else if (case2) message = new Message.Builder() .collapseKey("2") .addData("msg", msg).build(); else message = new Message.Builder().addData("msg", msg).build(); Result result = sender.sendNoRetry(message, regId); System.out.println("Message ID:"+result.getMessageId()); System.out.println("Failed:" + result.getErrorCodeName()); </code></pre> <p>From what I can see from tests with the above code, there are no error. The message id is present, but error code name is null(which is a sign of <a href="http://developer.android.com/reference/com/google/android/gcm/server/Result.html" rel="noreferrer">successful push</a>). </p> <p>I've tried almost every setting. Tested with TTL, collapse key, delay while idle set on and off.</p> <p>What are some cases that can cause to block(?) GCM push? And how can I resolve this?</p> <h2>EDIT</h2> <p>I have no idea why but the temporary solution below solved my problem.</p> <p>In GcmIntentService#onHandleIntent just remove</p> <pre><code>GcmBroadcastReceiver.completeWakefulIntent(intent); </code></pre> <p>This line releases the wakeful service. I am curious though because on other devices, push messages are sent continuously even when this line was not removed.</p> <p>This is not a solution because <a href="http://developer.android.com/reference/android/support/v4/content/WakefulBroadcastReceiver.html#startWakefulService%28android.content.Context,%20android.content.Intent%29" rel="noreferrer">this document</a> states that I should call completeWakeFulIntent after each work. Also, my method will drain the battery significantly.</p> <p>Any suggestion?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload