https://stackoverflow.com/questions/14749504/android-usermanager-check-if-user-is-owner-admin
http://blog.csdn.net/zhanglianyu00/article/details/50238447
http://blog.csdn.net/zhanglianyu00/article/details/50253187
http://gityuan.com/2016/11/20/user_manager/
Code snippet:
public static long getUserId(Context context){ UserHandle uh = Process.myUserHandle(); UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE); long userSerialNumber = -1; if(null != um) { userSerialNumber = um.getSerialNumberForUser(uh); } return userSerialNumber; }
沒有留言:
張貼留言