This article introduces the information of the HTML5 address book to obtain the designated multiple people. The details are as follows:
I. Get multiple personal information: Before solving the information of the communication recording, you must solve the information of obtaining multiple persons. I get the ID and DisplayName of all contacts in the address book through Plus.Contacts.Getadddressbook and address.find, and then obtain the page displayed by myself through the address book written by myself.
1. To solve this problem, first you have to write a JS address book yourself, so that you can separate all your contact first letters, and you can jump to the first letter you want.
2. Solution to get all contact information
Plus.Contacts.GetaddDressBook (Plus.Contacts.addressbook_phone, Function (addressbook) {// Get the address book information // can operate the address book operation adDRessbook.find (Null , Function (Contacts) {var username = New Array () ; Var linklist = new linkedList (); if (contacts.Length> 0) {// Get everyone in the current address book for (var I = 0; I <Contacts.Length; i) {username [i] = Contacts [ i] .displayName -Contacts [i] .id; // Connect the ID and username, the most prepared for screening in the future} // This code below is to classify the information of all contacts, which involves the JS page code written by myself. Linklist = sortpy (username); // Categorize the number of contacts in the number of contacts //linkList.show (); Createlicheckbox (linklist); // Classified information display to the page, I use Checkbox for multiple contacts to choose}, Function (e ) {Alert (Find contact error: e.message);});}, function (e) {});Second, guide multiple selected personal information from the communication recording: solve this problem. When creating a communication recorder before, you must put the contact ID on the page (hidden with Display), so that I can get the selected selected. You can get ID directly when checkbox, and put these IDs in an array. Then use Plus.Contacts.Getadddressbook and address.find to screen the contact information of these IDs.
1. Solve the use of CHECKBOX to get the contact ID. Here I use jQuery.
// Filter the selected Checkbox $ (input: checked) .each (function () {var INDEX = $ (this) .parent (). PRILDREN. Text (); ////// Get id var name = $ (this) .parent (). Prev (). Children ('p'). Text (); // Get the name username.push (name); usernameIndex.push (index);});}2. Solve these indexs in Find to screen information, and take out the contact information under the specific ID
Plus.Contacts.GetaddDressbook (Plus.Contacts.addressbook_phone, FUNCTION (addressbook) {// Get the address book information for (var j = 0; j <username.length; Selected contact, remember the cycle Be sure to put it here. At the beginning, I put it on plus.Contacts.getadddressbook outside. ; i) {// Whether it is multiple information, be sure to circulate array console.log (enter the loop); // var ID = contacts [i] .id; var displayName = contacts [i] .displayName; Var Phone = ; var dates =; var dates =; var remark =; if (contacts [i] .phonenumbers.length> 0) {// Here you need to determine whether it is empty. ] .phonenumbers [0]. Value;} Else {phone = contacts [i] .phonenumbers;} if (contacts [i] .emails.length> 0) {// Here you need to determine whether it is empty, no array for empty arrays. Index = 0; emails = Contacts [i] .emails [0]. Value;} Else {emails = Contacts [i] .emails;} Var datenum = new date (contacts [i] .bnsday) ;/ BIRTHDAY Is Number!! All The information is placed in a contactName: DisplayName, Sex:, Department:, POSITIONS:, Phone: Phone, Emails, BIRTHDAY: Dates, Hobby:, Remark: Here is my business Code, here you can write your own information // CreateContacttable (DB); // InsertContact (db, getContact); // The problem of multiple information insertion security occurs! Intersection Intersection Intersection Intersection Intersection Intersection } //console.log. Log (Username.length);}, Function (E) {console.log (query error);}, screening here is very important! Intersection Intersection In this way, you can select the matching information file: [{logic: or, filed: id, value: usernameIndex [j]}], multi: false});}}, function (e) {console.log );});You can get multiple contact information through the above code, you can try it. I hope it will be helpful to everyone's learning, and I hope that everyone will support VEVB Wulin.com.