Example Use case: Let's say an Android phone is in sleep mode and upon receiving a push notifications we want the phone to wake up (come out of sleep mode) and act upon (display etc.) the notification. In this case on receiving the notification which invokes the notification handler, we can wake up the processor by acquiring the Wakeup lock, act on the notification and then release the lock. The following code snippet shows the same:
package com.livrona.picwords.gcm;

import android.content.Context;
import android.os.PowerManager;

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

	/**
	 * Acquire the Lock
	 * 
	 * @param context
	 */
	public static void acquire(Context context) {
		if (wakeLock != null)
			wakeLock.release();

		PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
		wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
				"WakeLock");
		wakeLock.acquire();
	}

	/**
	 * Release the Lock
	 */
	public static void release() {
		if (wakeLock != null)
			wakeLock.release();
		wakeLock = null;
	}
}
In order to get the lock, make sure you declare the following permission in the Android Manifest. <!-- Keeps the processor from sleeping when a message is received. -->     <uses-permission android:name="android.permission.WAKE_LOCK" />