NicoN
NicoN

Reputation: 51

Android GCM notification don't appear when device is in sleep mode

I develop an android application with GCM Push Notification. I have started to use the sample of google. Push notifications work when the device is "on". When the device fall asleep, notifications don't appear but they show when I get android device out of sleep mode.

I saw that when I publish a content in Facebook or Snapchat, notification works perfectly in sleep mode so my question is : When I receive a push notification and the device is in sleep mode, how to show this notification ?

**

EDIT

I solve my problem on the server side. I have forgotten to set the property "delay_with_idle" to false in the message parameters.

For more information see the following documentation :

**

Upvotes: 3

Views: 3250

Answers (2)

NicoN
NicoN

Reputation: 51

I solve my problem on the server side. I have forgotten to set the property "delay_with_idle" to false in the message parameters.

For more information see the following documentation :

Upvotes: 2

Koh
Koh

Reputation: 1570

What kind of notification are you referring to? A sound notification? An icon in the status bar?

If what you intend to do is similar to the above, you may want to add custom code (like setSound()) in the GCMIntentService class's sendNotification() method. Here is the implementation of the class in the demo.

Upvotes: 0

Related Questions