Home Web Front-end H5 Tutorial Detailed explanation of the code for phonegap to complete the contact search function

Detailed explanation of the code for phonegap to complete the contact search function

May 20, 2017 pm 01:44 PM
Find Contact person

The following editor will bring you an implementation method of using phonegap to find contacts. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.

The examples are as follows:

<!DOCTYPE html> 
<html> 
  
    <head> 
        <meta charset="UTF-8"> 
        <title>Database Example</title> 
  
        <script type="text/javascript" charset="UTF-8" src="cordova.js"></script> 
        <script type="text/javascript" charset="UTF-8"> 
            document.addEventListener("deviceready", onDeviceReady, false); 
  
            function onDeviceReady() { 
            } 
              
            function onSuccess(contacts){ 
                document.write(contacts.length+&#39;contacts found.&#39;); 
                for(var i=0;i<contacts.length;i++){ 
                    for(var j=0;j<contacts[i].emails.length;j++){ 
                        document.write("Email="+contacts[i].emails[j].email); 
                    } 
                } 
                alert(&#39;success&#39;); 
            } 
              
            function onError(error){ 
                 alert("Ooops!"); 
            } 
              
            function findContact(){ 
                var myOptions=new ContactFindOptions(); 
                myOptions.filter="gmail";//过滤 
                var myFields=["emails"];//要查询的字段 
                navigator.contacts.find(myFields,onSuccess,onError,myOptions); 
            } 
              
        </script> 
    </head> 
  
    <body> 
        <button onclick="findContact();">Find Contact</button> 
    </body> 
  
</html>
Copy after login

[Related recommendations]

1. Html5 Free Video Tutorial

2. Detailed explanation of the code for phonegap to complete the cloning and deletion of contact functions

3. phonegap listens for the deviceready event to be triggered Other events after

4. Detailed explanation of examples that implement page jumps and can pass values

5. IE8 is not compatible with rgba() Detailed explanation of processing method

The above is the detailed content of Detailed explanation of the code for phonegap to complete the contact search function. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to sort photos by face on Windows 10 and 11 How to sort photos by face on Windows 10 and 11 Aug 08, 2023 pm 10:41 PM

The operation of Windows is getting better and better with every version, with attractive features to improve the user experience. One feature users will want to explore on Windows 10 and 11 is the ability to sort photos by faces. This feature allows you to group photos of friends and family using facial recognition. Sounds fun, right? Read on to learn how to take advantage of this feature. Can I group photos by faces on Windows? Yes, you can use the Photos app to group pictures by faces on Windows 10 and 11. However, this feature is not available on the Photos app version. Additionally, you can link these photos to contacts using the People tab. Therefore, using this function you can

8 Ways to Fix Contact Photos and Posters Disabled in iOS 17 8 Ways to Fix Contact Photos and Posters Disabled in iOS 17 Sep 22, 2023 am 10:33 AM

Learn the correct way to set up Contact Photos and Posters Contact Photos and Posters is a new feature that can be set up in iOS 17 for your contact cards and other contacts saved on your iPhone. For those who don’t know, the feature allows you to personalize the look of your call screen with custom posters, which you can design with photos, names, colors, fonts, emojis, and Memoji. Once created, contact posters can be shared with your saved contacts or restricted so that only a few selected people can view them. To learn how to create your own contact poster and how to share it with others, you can check out the guide at the following link: Contact Photos and Contact Posters Disabled: 8 Fixes Explained Despite Setting Contact Photos

How to add emergency contacts on Lalamove How to add emergency contacts on Lalamove Feb 29, 2024 pm 08:31 PM

When using the Lalamove software, there is an emergency contact function, which allows you to proactively contact the other party in an emergency. The following is an introduction to how to add an emergency contact. For those who don’t know yet, come and take a look with me. . First, open the Lalamove software on your mobile phone. After entering, click "My" in the lower right corner of the page to switch, and then click the gear-shaped icon in the upper right corner of the "My" page to enter the "Settings" function. 2. After coming to the settings page, click the "Add" button behind the "Emergency Contact" item. 3. Next, in the new interface, enter the phone number and name of the emergency contact according to the prompts. After entering, click the "Confirm Save" button below, and the emergency contact will be added.

How to turn off Find My iPhone How to turn off Find My iPhone Nov 09, 2023 pm 02:21 PM

What happens when you turn off Find My on iPhone? Find My iPhone helps you locate a lost or stolen device. When enabled, Find My iPhone lets you track your device's location on a map, plays sounds, and helps you find your device. Find My also includes an Activation Lock to prevent anyone from using your iPhone. When you turn off Find My iPhone, you lose all these features, which may make recovering a lost Apple device difficult. While Find My iPhone is very useful, you should disable it when you want to sell, donate, trade in your phone, or send it for battery replacement or any other service. Doing this will ensure that no one can access information about you

6 Fixes: How to solve the problem of contact poster not displaying properly on iPhone? 6 Fixes: How to solve the problem of contact poster not displaying properly on iPhone? Sep 17, 2023 pm 12:41 PM

1. Check if your iPhone supports iOS17 If the contact poster feature does not work on your iPhone, the first thing you should do is check if your iPhone supports iOS17. This new feature is only available on iPhones running iOS 17, so be sure to update your phone to the latest update. Additionally, even if your iPhone is running iOS17, your contacts should have iPhones with iOS17 updates. Here is a list of all iPhones that support iOS17: iPhone15, 15PlusiPhone15Pro, 15ProMaxiPhone14, 14PlusiPhone14Pro, 1

Find the index of an element in an array using the Array.IndexOf function in C# Find the index of an element in an array using the Array.IndexOf function in C# Nov 18, 2023 am 09:59 AM

Use the Array.IndexOf function in C# to find the index of an element in an array. In a C# program, when we need to find the index of an element in an array, we can use the Array.IndexOf function. The Array.IndexOf function finds the specified element within the specified array range and returns the index of its first occurrence. If the element is not found, -1 is returned. The following is a sample code that demonstrates how to use the Array.IndexOf function to find an element in an array.

How to personalize your iPhone on the latest iOS 17 How to personalize your iPhone on the latest iOS 17 Sep 21, 2023 am 08:17 AM

How to Personalize Calls on iPhone Apple’s iOS 17 introduces a new feature called Contact Posters that allows you to personalize the look of your call screen on your iPhone. This feature allows you to design a poster using selected photos, colors, fonts, and Memoji as contact cards. So when you make a call, your custom image will appear on the recipient's iPhone exactly as you envisioned. You can choose to share your unique contact poster with all your saved contacts, or choose who can see it. Likewise, during a call exchange, you will also see other people's contact posters. Additionally, Apple lets you set specific contact photos for individual contacts, making calls from those contacts

How to check the hard disk serial number and mac address How to check the hard disk serial number and mac address Feb 18, 2024 pm 07:45 PM

Hard drive serial numbers and MAC addresses are important identifiers in computer hardware and are very useful in managing and maintaining computer systems. This article will introduce how to find the hard disk serial number and MAC address. 1. Find the hard drive serial number. The hard drive serial number is a unique identifier used by the hard drive manufacturer to identify and track the hard drive. In different operating systems, the method of finding the hard drive serial number is slightly different. Windows: Open Command Prompt (search for "cmd" in the Start menu) and enter the following command and press Enter: wmicdisk

See all articles