Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading contacts

Tags:

android

I'm trying to read all the contacts stored in the phone using this code:

Cursor cursorNumber = context.getContentResolver().query( Contacts.Phones.CONTENT_URI, new String[] { Contacts.Phones._ID, Contacts.Phones.NAME, Contacts.Phones.NUMBER }, null, null, null );

but the result seems empty until the moment I sync the contacts with Google. Is that possible? Is it a limitation of Google Contacts API?

like image 338
Emanuele Avatar asked Mar 26 '26 23:03

Emanuele


1 Answers

You are using the old Contact APIs. Try using ContactsContract.

like image 196
Karan Avatar answered Mar 29 '26 13:03

Karan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!