Android Question AccountManager and device owner

luke2012

Well-Known Member
Licensed User
Longtime 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 ?

B4X:
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).
 

Attachments

  • debug.PNG
    debug.PNG
    15.5 KB · Views: 394
Last edited:
Top