Guest User

com.dbaq.cordova.contactsPhoneNumbers

a guest
Oct 7th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.78 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <!--
  4.  * Please see the included README.md file for license terms and conditions.
  5.  -->
  6. <head>
  7.     <title>Blank Cordova Mobile App Project Template (Lite)</title>
  8.     <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  9.  
  10.     <!-- see http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/quick-tip-dont-forget-the-viewport-meta-tag -->
  11.     <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  12.     <style>
  13.         /* following two viewport lines are equivalent to the meta viewport statement above, needed for Windows */
  14.         /* see http://www.quirksmode.org/blog/archives/2014/05/html5_dev_conf.html and http://dev.w3.org/csswg/css-device-adapt/ */
  15.         @-ms-viewport { width: 100vw ; zoom: 100% ; }  @viewport { width: 100vw ; zoom: 100% ; }
  16.         @-ms-viewport { user-zoom: fixed ; }           @viewport { user-zoom: fixed ; }
  17.     </style>
  18.  
  19.  
  20.  
  21. </head>
  22.  
  23. <body>
  24.  
  25.     <p>Hello, Cordova!</p>
  26. <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
  27. <script type="text/javascript" charset="utf-8" src="contactNumber.js"></script>
  28. <script>
  29.   function alertCarrier() {
  30.    navigator.contactsPhoneNumbers.list(function(contacts) {
  31.       alert(contacts.length + ' contacts found');
  32.       for(var i = 0; i < contacts.length; i++) {
  33.         alert(contacts[i].id + " - " + contacts[i].displayName);
  34.         for(var j = 0; j < contacts[i].phoneNumbers.length; j++) {
  35.            var phone = contacts[i].phoneNumbers[j];
  36.            alert("===> " + phone.type + "  " + phone.number + " (" + phone.normalizedNumber+ ")");
  37.          }
  38.       }
  39.    }, function(error) {
  40.       alert(error);
  41.    });
  42.   }
  43.  
  44.   document.addEventListener('deviceready', alertCarrier, false);
  45. </script>
  46. </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment