Read contacts event if there are no phone numbers present, improve permission check for SDK<23.

This commit is contained in:
B. Petersen
2017-04-29 00:14:21 +02:00
parent 5f9bfbef99
commit bcd22c50d3
@@ -101,10 +101,11 @@ public class ContactsController {
if (Build.VERSION.SDK_INT >= 23) {
return ApplicationLoader.applicationContext.checkSelfPermission(android.Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED;
}
/* -- no need for a fallback chack as the caller uses a try/catch anyway - and if this fails, there's nothing we can do
Cursor cursor = null;
try {
ContentResolver cr = ApplicationLoader.applicationContext.getContentResolver();
cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projectionNames, null, null, null);
cursor = cr.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, projectionNames, null, null, null);
if (cursor == null || cursor.getCount() == 0) {
return false;
}
@@ -119,6 +120,7 @@ public class ContactsController {
;
}
}
*/
return true;
}