美文网首页
android 多用户怎么判断主从用户

android 多用户怎么判断主从用户

作者: wenSome | 来源:发表于2023-09-24 14:02 被阅读0次

判断系统的主从用户

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
  // true 主用户  false 从用户
  UserManager userManager = (UserManager)context.getSystemService(Context.USER_SERVICE);
            boolean isPrimary = !userManager.isManagedProfile();
}

相关文章

网友评论

      本文标题:android 多用户怎么判断主从用户

      本文链接:https://www.haomeiwen.com/subject/xngfbdtx.html