0

How can I determine on Android 8 and above devices if a Google Account is available. Since Android 8 (Target SDK 26) the following code returns an empty result

Account[] accArray = accMan.getAccountsByType("com.google");

Several other developers that work with getAccountsByType have the same problem Android: AccountManager.getAccounts() returns an empty array

I don't want to access data from the account. I just want to determine if a specific type (here com.google) is present.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Philip Zultan
  • 184
  • 1
  • 8
  • Do you specify the `GET_ACCOUNTS` permission in your manifest and request it on runtime? – TheWanderer Oct 30 '18 at 13:11
  • Yes i specified the `GET_ACCOUNTS` permission in the manifest. I also check the permission with the following code. `ActivityCompat.checkSelfPermission(context, Manifest.permission.GET_ACCOUNTS)` But this isn't enough anymore, Android changed in Android 8. But it would be enough for me to detect the presence of a Google Account. I don't need to access it. – Philip Zultan Oct 30 '18 at 14:27

0 Answers0