为什么访问 android 中的电子邮件地址目录不需要权限?
How come permission is not required to access directory of email addresses in android?
下面的代码显示了 Android phone.
的整个电子邮件列表
val emailPickerIntent = Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI)
startActivityForResult(emailPickerIntent, REQUEST_CONTACTS_CODE)
我了解 Android 如果我们想要 read/write 通讯录,则需要用户明确授予权限。但是,在这种情况下,似乎不需要为电子邮件列表授予权限。 google 是否决定电子邮件不被视为敏感信息?
reveals me the entire email list of a Android phone
不,它会向用户显示整个电子邮件列表。您的应用程序代码无权访问该列表。
如果用户选择一个联系人,Uri
发送给您(在您的情况下通过 onActivityResult()
为 REQUEST_CONTACTS_CODE
)将允许您获取该个人联系人的详细信息。用户通过选择联系人,即授予您 short-term 访问该一位联系人的权限,并且仅授予该一位联系人。
Did google decide emails were not considered sensitive information?
他们有。这就是为什么您需要 READ_CONTACTS
才能直接查询 ContactsContract
提供商。但是,如果用户参与联系人选择,则用户选择的任何联系人都不需要该权限。
下面的代码显示了 Android phone.
的整个电子邮件列表 val emailPickerIntent = Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI)
startActivityForResult(emailPickerIntent, REQUEST_CONTACTS_CODE)
我了解 Android 如果我们想要 read/write 通讯录,则需要用户明确授予权限。但是,在这种情况下,似乎不需要为电子邮件列表授予权限。 google 是否决定电子邮件不被视为敏感信息?
reveals me the entire email list of a Android phone
不,它会向用户显示整个电子邮件列表。您的应用程序代码无权访问该列表。
如果用户选择一个联系人,Uri
发送给您(在您的情况下通过 onActivityResult()
为 REQUEST_CONTACTS_CODE
)将允许您获取该个人联系人的详细信息。用户通过选择联系人,即授予您 short-term 访问该一位联系人的权限,并且仅授予该一位联系人。
Did google decide emails were not considered sensitive information?
他们有。这就是为什么您需要 READ_CONTACTS
才能直接查询 ContactsContract
提供商。但是,如果用户参与联系人选择,则用户选择的任何联系人都不需要该权限。