2013-02-08 1 views
-1

장치 (android 4.2+)에서 구성된 사용자 목록을 찾는 방법이 있습니까?안드로이드에서 여러 사용자 얻기 4.2

감사합니다, Jeyanthi

+0

무엇을 의미합니까? –

+0

여러 사용자가 안드로이드 4.2와 함께 제공되는 새로운 기능입니다. 그래서 우리는 Windows OS에서하는 것처럼 하나 이상의 사용자 계정을 가질 수 있습니다. 그래서 나는 장치에 구성된 사용자 목록을 얻고 싶었습니다. http://developer.android.com/about/versions/android-4.2 .html – Jey

답변

1

음. 소스 코드가 UserManager.java 인 경우이 메소드를 찾을 수 있습니다. Hovewer, android.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; 
     } 
    } 
+0

감사합니다. Gabriele ... 알았어요. – Jey

관련 문제