-1

デバイス(android 4.2+)で構成されたユーザーのリストを見つける方法はありますか?

ありがとう、ジェヤンティ

4

1 に答える 1

1

上手。ソースコードが表示されている場合UserManager.javaは、これらのメソッドを見つけることができます。Hovewerandroid.permission.MANAGE_USERSは、これらのメソッドに必要です。

には署名|システムのMANAGE_USERS保護レベルがあります。つまり、アプリケーションはプラットフォームキーで署名する必要があります。

/**
     * Returns information for all users on this device.
     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
     * @return the list of users that were created.
     * @hide
     */
    public List<UserInfo> getUsers() {
        try {
            return mService.getUsers(false);
        } catch (RemoteException re) {
            Log.w(TAG, "Could not get user list", re);
            return null;
        }
    }

    /**
     * Returns information for all users on this device.
     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
     * @param excludeDying specify if the list should exclude users being removed.
     * @return the list of users that were created.
     * @hide
     */
    public List<UserInfo> getUsers(boolean excludeDying) {
        try {
            return mService.getUsers(excludeDying);
        } catch (RemoteException re) {
            Log.w(TAG, "Could not get user list", re);
            return null;
        }
    }
于 2013-02-08T11:33:29.987 に答える