Note that there are some explanatory texts on larger screens.

plurals
  1. POCall phonegap API from external page
    primarykey
    data
    text
    <p>I have a basic Android app that links to a few external webpages. I have placed phonegap.js on those pages and am trying to get to the GPS info but don't get anything. Basically, the app is set up to use a webview to load the external page. The external page simply has the sample code from the phonegap site but I don't get any GPS info. How can I get to the phonegap API if both the js and html page are on an external server?</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Device Properties Example&lt;/title&gt; &lt;script type="text/javascript" charset="utf-8" src="phonegap-1.1.0.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf-8"&gt; // Wait for PhoneGap to load // document.addEventListener("deviceready", onDeviceReady, false); // PhoneGap is ready // function onDeviceReady() { navigator.geolocation.getCurrentPosition(onSuccess, onError); } // onSuccess Geolocation // function onSuccess(position) { var element = document.getElementById('geolocation'); element.innerHTML = 'Latitude: ' + position.coords.latitude + '&lt;br /&gt;' + 'Longitude: ' + position.coords.longitude + '&lt;br /&gt;' + 'Altitude: ' + position.coords.altitude + '&lt;br /&gt;' + 'Accuracy: ' + position.coords.accuracy + '&lt;br /&gt;' + 'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '&lt;br /&gt;' + 'Heading: ' + position.coords.heading + '&lt;br /&gt;' + 'Speed: ' + position.coords.speed + '&lt;br /&gt;' + 'Timestamp: ' + new Date(position.timestamp) + '&lt;br /&gt;'; } // onError Callback receives a PositionError object function onError(error) { alert("error"); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p id="geolocation"&gt;Finding my geolocation...&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload