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 :

  1. 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.

  1. 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

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -