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


Java PowerManager.isInteractive方法代碼示例

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


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

示例1: wakeScreen

import android.os.PowerManager; //導入方法依賴的package包/類
/**
 * Waking up the screen
 * * * */
private static void wakeScreen(Context context){

    // Waking the screen so the user will see the notification
    PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);


    boolean isScreenOn;

    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH)
        isScreenOn = pm.isScreenOn();
    else
        isScreenOn = pm.isInteractive();

    if(!isScreenOn)
    {

        PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK
                |PowerManager.ON_AFTER_RELEASE
                |PowerManager.ACQUIRE_CAUSES_WAKEUP, "MyLock");

        wl.acquire(5000);
        wl.release();
    }
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:28,代碼來源:NotificationUtils.java

示例2: isScreenOn

import android.os.PowerManager; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public static boolean isScreenOn(PowerManager pm) {
	if (Version.sdkAboveOrEqual(20)) {
		return pm.isInteractive();
	} else {
		return pm.isScreenOn();
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:9,代碼來源:Compatibility.java

示例3: isIdle

import android.os.PowerManager; //導入方法依賴的package包/類
@SuppressWarnings({"deprecation", "ConstantConditions"})
public static boolean isIdle(Context context) {
    PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        return powerManager.isDeviceIdleMode() || !powerManager.isInteractive();
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        return !powerManager.isInteractive();
    } else {
        return !powerManager.isScreenOn();
    }
}
 
開發者ID:Doist,項目名稱:JobSchedulerCompat,代碼行數:12,代碼來源:DeviceUtils.java

示例4: isDeviceInteractive

import android.os.PowerManager; //導入方法依賴的package包/類
/**
 * Get whether the device is interactive currently
 * @param context a Context instance
 * @return true if the device is interactive, otherwise false
 */
public static boolean isDeviceInteractive(Context context) {
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        return pm.isInteractive();
    } else {
        return pm.isScreenOn();
    }
}
 
開發者ID:PrivacyStreams,項目名稱:PrivacyStreams,代碼行數:14,代碼來源:DeviceUtils.java

示例5: onPause

import android.os.PowerManager; //導入方法依賴的package包/類
@Override
protected void onPause() {
    super.onPause();
    PowerManager powerManager = (PowerManager)MainActivity.this.getSystemService(Context.POWER_SERVICE);
    Boolean isSceenAwake = (Build.VERSION.SDK_INT < 20? powerManager.isScreenOn():powerManager.isInteractive());

    if(!isSceenAwake){
        System.gc();
        Sensey.getInstance().stop();
    }
}
 
開發者ID:desaura,項目名稱:SimplyLauncher,代碼行數:12,代碼來源:MainActivity.java

示例6: isScreenOn

import android.os.PowerManager; //導入方法依賴的package包/類
private boolean isScreenOn() {
    try {
        PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
            return powerManager.isInteractive();
        } else {
            return powerManager.isScreenOn();
        }
    } catch (Exception e) {
        Log.e(TAG, "e:", e);
    }
    return false;
}
 
開發者ID:isuperqiang,項目名稱:AndroidKeepLivePractice,代碼行數:14,代碼來源:OnepxActivity.java

示例7: isInteractive

import android.os.PowerManager; //導入方法依賴的package包/類
/**
 * @return Whether the screen of the device is interactive.
 */
@SuppressWarnings("deprecation")
public static boolean isInteractive(Context context) {
    PowerManager manager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        return manager.isInteractive();
    } else {
        return manager.isScreenOn();
    }
}
 
開發者ID:lizhangqu,項目名稱:chromium-net-for-android,代碼行數:13,代碼來源:ApiCompatibilityUtils.java

示例8: isInteractive

import android.os.PowerManager; //導入方法依賴的package包/類
public static boolean isInteractive(Context context) {
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT_WATCH)
        return (pm != null && pm.isScreenOn());
    else
        return (pm != null && pm.isInteractive());
}
 
開發者ID:miankai,項目名稱:MKAPP,代碼行數:8,代碼來源:Util.java

示例9: isScreenOn

import android.os.PowerManager; //導入方法依賴的package包/類
private boolean isScreenOn() {
    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);

    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
        // API >= 20
        return pm.isInteractive();
    }

    // API <= 19, use deprecated
    //noinspection deprecation
    return pm.isScreenOn();
}
 
開發者ID:abhijitvalluri,項目名稱:fitnotifications,代碼行數:13,代碼來源:NLService.java

示例10: isScreenOn

import android.os.PowerManager; //導入方法依賴的package包/類
/** 屏幕是否處於活動狀態 */
public static boolean isScreenOn() {
    PowerManager pm = getPowerManager();
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        return pm.isInteractive();
    } else {
        return pm.isScreenOn();
    }
}
 
開發者ID:A-Miracle,項目名稱:QiangHongBao,代碼行數:10,代碼來源:NotifyUtils.java

示例11: isHeadsUpAllowed

import android.os.PowerManager; //導入方法依賴的package包/類
private static boolean isHeadsUpAllowed(StatusBarNotification sbn, Context context) {
    if (context == null) return false;

    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    Notification n = sbn.getNotification();
    return (pm.isInteractive() &&
            keyguardAllowsHeadsUp(context) &&
            (!sbn.isOngoing() || n.fullScreenIntent != null || (n.extras.getInt("headsup", 0) != 0)));
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:10,代碼來源:ModLedControl.java

示例12: isScreenOn

import android.os.PowerManager; //導入方法依賴的package包/類
public static boolean isScreenOn(Context context) {
    PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        //noinspection deprecation
        return powerManager.isScreenOn();
    } else {
        return powerManager.isInteractive();
    }
}
 
開發者ID:XFY9326,項目名稱:KeyBlocker,代碼行數:10,代碼來源:BaseMethod.java

示例13: onPause

import android.os.PowerManager; //導入方法依賴的package包/類
@Override
protected void onPause() {
    super.onPause();
    PowerManager p = (PowerManager) getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        if(!p.isInteractive()){System.gc();}}else {if(!p.isScreenOn()){System.gc();}}}
 
開發者ID:desaura,項目名稱:SimplyLauncher,代碼行數:7,代碼來源:AppListActivity.java

示例14: onCreate

import android.os.PowerManager; //導入方法依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    new FullScreenActivity().invoke();
    setContentView(R.layout.activity_prayer_image);
    getSupportActionBar().hide();
    context = this;


    if (getIntent().hasExtra(MOSQUE_TYPE)) {
        mosque_type = getIntent().getExtras().getString(MOSQUE_TYPE);
        Log.i("ACTIVITY_SRAT" , "activity is working well"+" Type : "+mosque_type);

    }

    if(getIntent().hasExtra(PRAY_TYPE)){
        pray = getIntent().getExtras().getString(PRAY_TYPE);
    }


    img = (AutoZoomInImageView) findViewById(R.id.img_pray);
    praysTxt = (TextView) findViewById(R.id.txt_pray);


    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    boolean isScreenOn = pm.isInteractive();

    if (isScreenOn){
        playAnimation();
    }



    praysTxt.setText(getString(R.string.now_coming_prays)
            .concat(" ").concat(pray));


        if (mosque_type.equalsIgnoreCase(MOSQUE_DAY)) {
            Log.i("ACTIVITY_SRAT" , "Day ");
                    showImage(R.drawable.mosque_day);
        }else if (mosque_type.equalsIgnoreCase(MOSQUE_NIGHT)){
            Log.i("ACTIVITY_SRAT" , "night ");
            showImage(R.drawable.mosque_night);
        }


}
 
開發者ID:fekracomputers,項目名稱:MuslimMateAndroid,代碼行數:49,代碼來源:PrayerImageActivity.java


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