当前位置: 首页>>代码示例>>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;未经允许,请勿转载。