Gcm Client Does Not Receive Downstream Messages
My app server is sending out messages to GCM successfully, however, in the client side, the messages are not being received, even though it has the token and it has been subscribed
Solution 1:
I think you are missing the BroadcastReceiver in your code that serves the purpose of receiving the Broadcast that has been send by the GCM server for your app clients to process. You need to check for the following lines in the code:
/**
* Receiving push messages
* */privatefinalBroadcastReceivermHandleMessageReceiver=newBroadcastReceiver() {
@OverridepublicvoidonReceive(Context context, Intent intent) {
StringnewMessage= intent.getExtras().getString(EXTRA_MESSAGE);
// Waking up mobile if it is sleeping
WakeLocker.acquire(getApplicationContext());
/**
* Take appropriate action on this message
* depending upon your app requirement
* For now i am just displaying it on the screen
* */// Showing received message
lblMessage.append(newMessage + "\n");
Toast.makeText(getApplicationContext(), "New Message: " + newMessage, Toast.LENGTH_LONG).show();
// Releasing wake lock
WakeLocker.release();
}
};
For more code description take a look at this tutorial.
Post a Comment for "Gcm Client Does Not Receive Downstream Messages"