cordova / phonegap 3.0 device properties -


i new phonegap / cordova 3.0 , seems have similar problem phonegap help: device properties, cordova v phonegap, xcode debugging. unfortunately couldn't find solution in internet now.

after having created hello world example ios works fine in simulator. after having changed content in index.html code of example given device properties in den documentation screen of simulator shows "loading device properties.." nothing more. reason function ondeviceready() not work properly. highly appreciated

here code of index.html device properties

<!doctype html> 

device properties example

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>     <script type="text/javascript" charset="utf-8">          // wait device api libraries load         //         document.addeventlistener("deviceready", ondeviceready, false);          // device apis available         //         function ondeviceready() {             var element = document.getelementbyid('deviceproperties');             element.innerhtml = 'device name: '     + device.name     + '<br />' +             'device cordova: '  + device.cordova  + '<br />' +             'device platform: ' + device.platform + '<br />' +             'device uuid: '     + device.uuid     + '<br />' +             'device model: '    + device.model    + '<br />' +             'device version: '  + device.version  + '<br />';         }          </script> </head> <body>     <p id="deviceproperties">loading device properties...</p> </body> 

screenhot of xcode , simulator

as mentioned in other question linked to, think issue here may missing plugin. ondeviceready function should working (try throwing alert in there, test out)... think may running issues when you're trying access things device.model , device.version.

in order access device object, need install plugin. copying in example code won't work without plugin. if haven't done already, grab plugin using:

$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git 

hopefully trick you.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -