In Android, how can I get the number when someone outside of contacts is calling? -
my getcontactname() method not returning when caller unknown (edit - not blocked or hidden - not in contacts). can't figure how display. if caller contact works fine.
my method:
private string getcontactname(string number) { string name = null; string[] projection = new string[]{ contactscontract.phonelookup.display_name, contactscontract.phonelookup._id}; uri contacturi = uri.withappendedpath(contactscontract.phonelookup.content_filter_uri, uri.encode(number)); cursor cursor = this.c.getcontentresolver().query(contacturi, projection, null, null, null); if (cursor != null) { if (cursor.movetofirst()) { name = cursor.getstring(cursor.getcolumnindex(contactscontract.phonelookup.display_name)); } else { } cursor.close(); } return name; } what need change display? passes number fine when user has in contacts.
Comments
Post a Comment