Code example for PowerManager.WakeLock

Methods: setReferenceCounted

		public Receiver(Runnable runnable) {
		    this.runnable = runnable;
		    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
		    this.wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
		public void onReceive(Context context, Intent intent) {
			 * The #run() call can block, so do it on a background thread. The 
			 * phone could sleep after onReceive() exits but before the 
			 * background thread completes, so to prevent that, take a wakelock 
			 * before returning and release it after the background thread 
			 * completes. 
			new Thread(new Runnable() {
				public void run() {