cordova - Phonegap heading example code not working -
i completly new 'phonegap'. have tested example code displays current heading , works in local ripple emulator.
however when deploy android not work? nothing , no error written page.
the following code should display compass heading screen:
<!doctype html> <html> <head> <title>compass example</title> <script type="text/javascript" charset="utf-8" src="phonegap-1.0.0.js"></script> <script type="text/javascript" charset="utf-8"> // wait phonegap load // document.addeventlistener("deviceready", ondeviceready, false); // phonegap ready // function ondeviceready() { navigator.compass.getcurrentheading(onsuccess, onerror); } // onsuccess: current heading // function onsuccess(heading) { document.write('heading: ' + heading); } // onerror: failed heading // function onerror() { document.write('error'); } </script> </head> <body> <h1>example</h1> <p>getcurrentheading</p> </body> </html>
the code taken from: http://docs.phonegap.com/en/1.0.0/phonegap_compass_compass.md.html
i haven't gone down route of remote debugging yet hoping there obvious doing wrong.
Comments
Post a Comment