Code example for PowerManager.WakeLock

Methods: acquire

0
    		// don't let the phone fall asleep during sync 
    		final PowerManager powerManager = 
    			(PowerManager)getSystemService(Context.POWER_SERVICE);
    		this.wakeLock = powerManager.newWakeLock(
    				PowerManager.PARTIAL_WAKE_LOCK, BackgroundService.TAG);
    		wakeLock.acquire();
    		super.onPreExecute(); 
    	} 
    	 
		@Override protected void onPostExecute(Integer result) {
			Log.d(BackgroundService.TAG,"SYNC Post-execute complete!");
			super.onPostExecute(result);
			this.wakeLock.release();
			// schedule the next occurrence: 
			BackgroundService.this.scheduleSync(false);
            // Done with our work...  stop the service! 
            BackgroundService.this.stopSelf(startID);    
    	} 
    }; 
     
    /**