androidandroid-securityexception

Why do I need the permission READ_CONTACTS to read the call log?


The App is reading the call log. On most devices that is fine, some others get SecurityException for READ_CONTACTS (which I don't have and don't want in my AndroidManifest.xml.

Why is that and can I do something about that? Perhaps through a projection, which does not fetch the CACHED_NAME?


Solution

  • android.permission.READ_CALL_LOG was introduced in API Level 16. Before that, it was implicit in android.permission.READ_CONTACTS and didn't exist as a separate permission. I suspect your trouble is with API 15 and lower devices since they will ignore your manifest's uses-permission line for READ_CALL_LOG and thus have no permission for reading the logs. For those devices, READ_CONTACTS is the correct permission.