下面列出了android.app.ActivityManager#LOCK_TASK_MODE_NONE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
protected void onStart() {
super.onStart();
// start lock task mode if it's not already active
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
// ActivityManager.getLockTaskModeState api is not available in pre-M.
if (Util.SDK_INT < VERSION_CODES.M) {
if (!am.isInLockTaskMode()) {
startLockTask();
}
} else {
if (am.getLockTaskModeState() == ActivityManager.LOCK_TASK_MODE_NONE) {
startLockTask();
}
}
}
@Override
protected void onStart() {
super.onStart();
// start lock task mode if its not already active
if(mDevicePolicyManager.isLockTaskPermitted(this.getPackageName())){
ActivityManager am = (ActivityManager) getSystemService(
Context.ACTIVITY_SERVICE);
if(am.getLockTaskModeState() ==
ActivityManager.LOCK_TASK_MODE_NONE) {
startLockTask();
}
}
}
@Override
protected void onStart() {
super.onStart();
// Start lock task mode if its not already active
if(mDevicePolicyManager.isLockTaskPermitted(this.getPackageName())){
ActivityManager am = (ActivityManager) getSystemService(
Context.ACTIVITY_SERVICE);
if (am.getLockTaskModeState() ==
ActivityManager.LOCK_TASK_MODE_NONE) {
startLockTask();
}
}
}
private static boolean isTaskLocked() {
return getActivityManager().getLockTaskModeState() !=
ActivityManager.LOCK_TASK_MODE_NONE;
}