當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyguardManager.isKeyguardLocked方法代碼示例

本文整理匯總了Java中android.app.KeyguardManager.isKeyguardLocked方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyguardManager.isKeyguardLocked方法的具體用法?Java KeyguardManager.isKeyguardLocked怎麽用?Java KeyguardManager.isKeyguardLocked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.KeyguardManager的用法示例。


在下文中一共展示了KeyguardManager.isKeyguardLocked方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onReceive

import android.app.KeyguardManager; //導入方法依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {

    KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);

    //Log.d("Smarper-Features", "Got screen update");
    featuresLock.lock();
    try {
        if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
            currentFeatures.screenOn = true;
            //Log.d("Smarper-Debug", "Screen became interactive");
        } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {

            currentFeatures.screenOn = false;
            //Log.d("Smarper-Debug", "Screen became not interactive");

            //Update locked state:
            currentFeatures.screenLocked = km.isKeyguardLocked();
            //Log.d("Smarper-Debug", "Screen is locked: " + currentFeatures.screenLocked);

        } else { //ACTION_USER_PRESENT, i.e. screen is unlocked
            currentFeatures.screenLocked = false;
            // Log.d("Smarper-Debug", "Screen unlocking");
        }


    } finally {
        featuresLock.unlock();
    }
}
 
開發者ID:lca1,項目名稱:smarper,代碼行數:31,代碼來源:Smarper.java

示例2: isKeyguardUp

import android.app.KeyguardManager; //導入方法依賴的package包/類
public boolean isKeyguardUp() {
    KeyguardManager km = (KeyguardManager) this.context.getSystemService(Context.KEYGUARD_SERVICE);
    return km.inKeyguardRestrictedInputMode() || km.isKeyguardLocked();
}
 
開發者ID:bunnyblue,項目名稱:NoticeDog,代碼行數:5,代碼來源:LockScreenManager.java

示例3: isLocked

import android.app.KeyguardManager; //導入方法依賴的package包/類
/**
 * Checks the lock state of the device.
 *
 * @return <code>true</code> if the device is in locked state and <code>false</code> otherwise.
 */
private boolean isLocked() {
    KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    return keyguardManager.isKeyguardLocked();
}
 
開發者ID:MusalaSoft,項目名稱:atmosphere-service,代碼行數:10,代碼來源:AgentRequestHandler.java


注:本文中的android.app.KeyguardManager.isKeyguardLocked方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。