Code example for PowerManager.WakeLock

Methods: acquire

0
        /* 
         * when the activity is resumed, we acquire a wake-lock so that the 
         * screen stays on, since the user will likely not be fiddling with the 
         * screen or buttons. 
         */ 
        mWakeLock.acquire();
 
        // Start the simulation 
        mSimulationView.startSimulation();
    } 
 
    @Override 
    protected void onPause() { 
        super.onPause(); 
        /* 
         * When the activity is paused, we make sure to stop the simulation, 
         * release our sensor resources and wake locks 
         */ 
 
        // Stop the simulation 
        mSimulationView.stopSimulation();