I'm developing an application, where I want to send the users account in an email. I've tried every example here in stackoverflow, also checked the Android Development site, but I couldn't retrieve any information using AccountManager. I've found the following information:
"In Android 8.0 (API level 26), apps can no longer get access to user accounts unless the authenticator owns the accounts or the user grants that access", but I still have no idea how to make get the account name.
Can anybody provide a working code snippet? It should work just with this:
AccountManager accountManager = AccountManager.get(getApplicationContext());
Account[] accounts = accountManager.getAccountsByType("com.google");
Manifest:
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
I'm developing for android wear.