Android Question AccountManager and device owner

Discussion in 'Android Questions' started by luke2012, Nov 2, 2016.

  1. luke2012

    luke2012 Well-Known Member Licensed User

    Hi to all,
    the following reflector code return all accounts defined within the Android device.

    How to find the account (owner) that activated the Android device for the first time ?
    Is it the n.0 account in the accounts array ?

    Code:
    public Sub GetUserAccountMail As String
        
    Dim r As Reflector
        r.Target = r.RunStaticMethod(
    "android.accounts.AccountManager""get", _
           
    Array As Object(r.GetContext), Array As String("android.content.Context"))
        
    Dim accounts() As Object
        accounts = r.RunMethod2(
    "getAccountsByType","com.google""java.lang.String")
        
    For i = 0 To accounts.Length - 1
           r.Target = accounts(i)
           
    Dim accountName As String
           accountName = r.GetField(
    "name")
           
    Log(accountName)
        
    Next
        
    Return accountName
    End Sub
    Within the accounts returned I can see name and type info only (see attached image).
     

    Attached Files:

    Last edited: Nov 2, 2016
  2. Erel

    Erel Administrator Staff Member Licensed User

    I don't think that this information is available or that it is possible to say whether the first account is special in any way.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice