java - Searching Phone number in Android Code -
i trying implement functionality in android app user keys in numbers, want incrementally search numbers in phone book (the generic phone book search) , display result.
for this, using
uri.withappendedpath(contactscontract.commondatakinds.phone.content_filter_uri, uri.encode(anumber));
this seems work of cases , handling search ' ' etc.
there 2 issues not able resolve :
- it not ignore country code.
so e.g. if have number : +9199776xx123 when search string +9199, result comes up. while if search string 9977, not come up.
- it not search between. when search string 776, result not come up.
so behavior of content_filter_uri of phone not clear me.
p.s. : have tried phonelookup reason, not throw result. belief might not capable searching partial numbers.
phone.content_filter_uri
built speed, it's not perfect, you've noticed. can use plain phone.content_uri
process kind of request want.
e.g.:
string partialphone = "9977"; string[] projection = new string[] {phone.display_name, phone.number, phone. normalized_number}; string selection = "(" + phone.number + " %" + partialphone + "%) or (" + phone.normalized_number + " %" + partialphone + "%)"; cursor c = cr.query(data.content_uri, projection, selection, null, null);
Comments
Post a Comment