Here is the code that works for me:
NotificationManager mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(...); ... mManager.notify(0, notification); PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "TAG"); wl.acquire(15000);
Make sure you send a notification from your server using delay_while_idle=0 (this is the default) or the notification will not be sent by GCM until your device wakes up.
source share