Code example for PowerManager

Methods: goToSleep

0
        } 
    } 
 
    private void screenOff() { 
        PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
        pm.goToSleep(SystemClock.uptimeMillis());
    } 
 
    private void startAssistActivity() { 
        IWindowManager mWm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
        boolean isKeyguardShowing = false;
        try { 
            isKeyguardShowing = mWm.isKeyguardLocked();
        } catch (RemoteException e) {
 
        } 
 
        if (isKeyguardShowing) {
            try { 
                mWm.showAssistant();
            } catch (RemoteException e) {