According to the solution here, I want to get the profile info of the device owner in Android contact.
String[] columnNames = new String[] {ContactsContract.Profile.DISPLAY_NAME};
Cursor c = this.getContentResolver().query(ContactsContract.Profile.CONTENT_URI, columnNames, null, null, null);
int count = c.getCount();
Permissions are added in manifest,
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.READ_PROFILE"/>
I have added valid name and number in contact. I am getting count = 0.
, My expectation is to get nonzero count. What could be the possible reason?
According to the answer from this post, AndroidManifest.xml should include the proper permission,
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>