Is there any way to determine if there are other users installed on the device or if the device is being used a single user tablet?
Along those lines is it possible to get the name, id, or Google account of the current user?
Is there any way to determine if there are other users installed on the device or if the device is being used a single user tablet?
Along those lines is it possible to get the name, id, or Google account of the current user?
要回答您的第二个问题,此代码将返回当前用户的所有 Google 帐户:
AccountManager manager = AccountManager.get(context);
Account[] accounts = manager.getAccountsByType("com.google");
您还需要在清单中获得此权限:
<uses-permission android:name="android.permission.GET_ACCOUNTS" /
有关帐户信息,请参阅AccountManager
课程。这应该向您显示设备上的帐户并允许您确定其他用户等。
有关详细信息,请查看以下帖子(以及其他类似的帖子......):