I am trying to find contact details matching sms from sms phone mail. In my opinion, a column personis a foreign key of a column _id ContactsContract.Contacts.
My problem is that I am getting the wrong values for the value personfrom the sms request. Some identifiers persondo not exist in the contact table, and some indicate completely different contacts.
Below is the code that I use to get a list of values person. Can someone tell me that I missed something or ran into a similar problem.
Tested with Nexus S running Android 4.1.2
Uri parsedUri = Uri.parse("content://sms/inbox");
String[] projection = new String[] { "_id", "address", "person" };
Cursor cursor = contentResolver.query(parsedUri, projection, null, null, null);
Log.d(TAG, "Total Count " + cursor.getCount());
if (cursor.getCount() > 0) {
int person;
int personIndex = cursor.getColumnIndex("person");
if (cursor.moveToFirst())
do {
person = cursor.getInt(personIndex);
if (person > 0) {
}
} while (cursor.moveToNext());
}
cursor.close();
: Android Developer Portal (http://developer.android.com/guide/topics/providers/contacts-provider.html), , person, sms inbox ContactsContract.RawContacts ContactsContract.Contacts, .