- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody,
I'm a new user of intel XDK and i tried to do something simple as :
- get contacts in my phone
- display their display name
I arrived to do that I want in environment XDK but when i do a debug across my physical phone i have an error.
<!DOCTYPE html> <html> <head> <title>Using PhoneGap Audio Media</title> <meta content="text/html; charset=utf-8" http-equiv="Content-type"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"> <style type="text/css"> /* Prevent copy paste for all elements except text fields */ * { -webkit-user-select:none; -webkit-tap-highlight-color:rgba(255, 255, 255, 0); } input, textarea { -webkit-user-select:text; } </style> <script type="text/javascript"> /* This function runs once the page is loaded, but intel.xdk API is not yet active */ var init = function(){ }; window.addEventListener("load",init,false); /* This code prevents users from dragging/scrolling the page */ var preventDefaultScroll = function(event) { event.preventDefault(); window.scroll(0,0); return false; }; document.addEventListener('touchmove', preventDefaultScroll, false); </script> <script src="appframework/appframework.ui.min.js" type="text/javascript"></script> <script src="intelxdk.js"></script> <script type="text/javascript"> /* This code is used to run as soon as intel.xdk.device.ready is active */ var onDeviceReady=function(){ //hide splash screen intel.xdk.device.hideSplashScreen(); }; document.addEventListener("intel.xdk.device.ready",onDeviceReady,false); </script> <script src="cordova.js" type="text/javascript"></script> <script type="text/javascript"> function onDeviceReady() { var options = new ContactFindOptions(); var fields = ["*"]; navigator.contacts.find(fields, onSuccess, onError); } function onSuccess(contacts) { for (var i = 0; i < contacts.length; i++) { document.write("<br>Display Name = " + contacts.displayName); } } function onError(contacts) { document.write('Error<br>'); try { for (var i = 0; i < contacts.length; i++) { document.write("<br>Display Name = " + contacts); } } catch (e){ console.log("<br>error "+e); } } document.addEventListener("deviceready", onDeviceReady, false); </script> </head> <body> </script> </body> </html>
All time after calling navigator.contacts.find, I'm redirected to onError function and it seems that i have an error json.
Could you help me please
- Tags:
- HTML5
- Intel® XDK
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try the following script tag lines:
<script src="intelxdk.js"></script> <script src="cordova.js"></script>

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page