0

i am using Samsung Galaxy Note. When my phone is in locked state, and when i click the power button i see the pattern unlocking screen. When new messages flow in, i just see a mail icon in the top status bar, but no other notifications in the screen. what needs to be done for that?

Senthil
  • 61
  • 1
  • 5

1 Answers1

0

You have to wakeup the device when push message came.

onMesaage method of GCM service you have to call below code

public abstract class WakeLocker {
    private static PowerManager.WakeLock wakeLock;

    public static void acquire(Context ctx) {
        if (wakeLock != null) wakeLock.release();

        PowerManager pm = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE);
        wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK |
                PowerManager.ACQUIRE_CAUSES_WAKEUP |
                PowerManager.ON_AFTER_RELEASE, MainActivity.APP_TAG);
        wakeLock.acquire();
    }

    public static void release() {
        if (wakeLock != null) wakeLock.release(); wakeLock = null;
    }
}

See the below link

android AlarmManager not waking phone up

Community
  • 1
  • 1
koti
  • 3,681
  • 5
  • 34
  • 58