Sunday, 15 September 2013

java - Only get android contacts that are saved to the phone or sim -



java - Only get android contacts that are saved to the phone or sim -

i trying retrieve contacts on android device explicitly saved (i.e. not ones returned gmail or facebook , other apps save contact-like information). have been playing around code block phonegap contacts plugin:

cursor idcursor = mapp.getactivity().getcontentresolver().query(contactscontract.data.content_uri, new string[] { contactscontract.data.contact_id }, whereoptions.getwhere(), whereoptions.getwhereargs(), contactscontract.data.contact_id + " asc");

i modified various arguments , tried querying based on contactscontract.rawcontacts.account_type no luck. how can modify code block above accomplish need?

whether or not contacts appear in regular contacts determined next property:

contactscontract.contacts.in_visible_group

i modified 1 of queries business relationship , removed contacts returned aren't contacts (such gmail history, ...etc):

options.setwhere("(" + contactscontract.contacts.in_visible_group + " = 1 , " + contactscontract.data.contact_id + " ? )");

the query in original question (from cordova contacts plugin) gets ids match provided search term, query modify 1 later in plugin code (more accurately corresponding getwhere() function modified business relationship in_visible_group property):

cursor c = mapp.getactivity().getcontentresolver().query(contactscontract.data.content_uri, columnstofetch.toarray(new string[] {}), idoptions.getwhere(), idoptions.getwhereargs(), contactscontract.data.contact_id + " asc");

i hosted modified version of plugin on my github. note version works instances there no search term.

java android cordova android-contacts cordova-plugins

No comments:

Post a Comment