Note that there are some explanatory texts on larger screens.

plurals
  1. POPhonegap build "deviceready" event never fires if the location service is turned off
    primarykey
    data
    text
    <p>I have written a webapp using JQM (1.3.1), jQuery(1.9), CSS3 and javascript now I am in the second phase where I am porting this app to Apple store using phone gap (2.7) (target iOS(6.1)/iPhone5 - Issue can be reproduced on iPhone 4S/ iOS 6.0</p> <p>My geolocation code as shown below worked fine when it was executed in a browser.</p> <pre><code>var geoOptions = { 'enableHighAccuracy': true, 'timeout': 10000, 'maximumAge': 0 }; navigator.geolocation.getCurrentPosition(geoSuccess, geoError, geoOptions); function geoSuccess(postion) { //on success code here } function geoError(error) { //on error code here } </code></pre> <p>However once passed through phonegap then my app requested user permission to access the location service twice i.e. it showed a pop up twice. Hence to resolve that I used the code below as suggested in many solutions on stackoverflow.</p> <pre><code>function onDeviceReady() { navigator.geolocation.getCurrentPosition(geoSuccess, geoError,geoOptions); } $(function() { document.addEventListener("deviceready", onDeviceReady, false); }); </code></pre> <p>This resolved the pop up issue however started a new one.</p> <p>Issue: if the location service is disabled my code adds the deviceready listener and waits for the deviceready event to fire however the event never fires and it just sits there. If the location service is turned on it works as expected.</p> <p>Has anyone faced this issue before can you please suggest me what you did to resolve it, please I have already invested a day worth debug and research time in it.</p> <p>Kind regards and thank you.</p>
    singulars
    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.
    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