检查 android 上的用户帐户

Check user account on android m

我正在尝试检查 Android-M 设备上是否有任何用户帐户(带有电子邮件地址)。

我不在乎邮件是什么或有多少,只是一个 yes/no 问题。

我可以用正常且不危险权限检查吗?

谢谢。

对于 6.0 及更高版本的设备,GET_ACCOUNTS 是签名权限。

否则是危险权限

GET_ACCOUNTS

Note: Beginning with Android 6.0 (API level 23), if an app shares the signature of the authenticator that manages an account, it does not need "GET_ACCOUNTS" permission to read information about that account. On Android 5.1 and lower, all apps need "GET_ACCOUNTS" permission to read information about any account.

Signature permission:

A permission that the system grants only if the requesting application is signed with the same certificate as the application that declared the permission. If the certificates match, the system automatically grants the permission without notifying the user or asking for the user's explicit approval.

请注意,作为是或否问题,如果您需要有关此的更多详细信息,则需要提出一个新问题。