MTK gets cell phone contacts and SIM card contacts.

Source: Internet
Author: User



Uri MUri =uri.parse ("content://com.android.contacts/contacts?android.provider.extra.address_book_index=true& Directory=0 ");//contactscontract.commondatakinds.phone.content_uri; URI of the contact person

string[] mprojection = new string[] {
contacts._id,//0
Contacts.display_name_primary,//1
Contacts.contact_presence,//2
Contacts.contact_status,//3
CONTACTS.PHOTO_ID,//4
Contacts.photo_thumbnail_uri,//5
Contacts.lookup_key,//6
Contacts.is_user_profile,//7
Contacts.phonetic_name,//8
Contacts.indicate_phone_sim,
Contacts.index_in_sim,
Contacts.is_sdn_contact,
Contacts.is_sdn_contact,

};



int mselecttype = 0;

if (mselecttype==0)
Mqueryhandler.startquery (Query_token, NULL, URI, projection, getcontactselection (), NULL, Getsortorder (projection)) ;//all
else if (mselecttype==1)//sim1
Mqueryhandler.startquery (0, NULL, MUri, mprojection, "EXISTS" (SELECT DISTINCT contact_id from View_raw_contacts WHERE _sdn_contact < 1 and contact_id = view_contacts._id, account_type= ' USIM account ' and account_name= ' USIM1 ' and Data_ ' Set is null)) ", NULL," Sort_key ");
else if (mselecttype==2)//sim2
Mqueryhandler.startquery (0, NULL, MUri, mprojection, "EXISTS" (SELECT DISTINCT contact_id from View_raw_contacts WHERE _sdn_contact < 1 and contact_id = view_contacts._id, account_type= ' USIM account ' and account_name= ' USIM2 ' and Data_ ' Set is null)) ", NULL," Sort_key ");
Else
Mqueryhandler.startquery (0, NULL, MUri, mprojection, "EXISTS" (SELECT DISTINCT contact_id from View_raw_contacts WHERE _sdn_contact < 1 and contact_id = view_contacts._id and (Account_type is null and account_name-is null and Data_set I S null OR account_type= ' local phone account ' and account_name= ' phone ' and data_set are null) ', NULL, ' Sort_key ';//phon E

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.