Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7704109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:36:40+00:00 2026-05-31T23:36:40+00:00

When I run window.onload = function () { document.addEventListener(deviceready, getGeolocation); } function getGeolocation() {

  • 0

When I run

window.onload = function () {
   document.addEventListener("deviceready", getGeolocation);
}

function getGeolocation() {
 navigator.geolocation.getCurrentPosition( successCallback, errorCallback, {maximumAge: 0});
}

or

function getGeolocation() {
 watchGeoMarkerProcess = navigator.geolocation.watchPosition(updateCallback, errorCallback);
}

and then

function updateCallback(position) {
   if (position.coords.accuracy < 100) {
            navigator.geolocation.clearWatch(watchGeoMarkerProcess);
   }
}

in my app on iOS 5 using phonegap it seems to get stuck, since the geolocation indicator-icon stays in the top bar and it never goes away, which I take to mean that the GPS doesn’ get turned off. Also, sometimes I don’t get any coords at all, throwing a time-out error.

I don’t think there is anything wrong with the code since it works just fine as a webapp.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:36:41+00:00Added an answer on May 31, 2026 at 11:36 pm

    navigator._geo is the ‘real’ implementation I believe. I’ve seen recent git commits where they are trying to over-ride navigator.geolocation but apparently failing on iOS. Looking at the phonegap source code gave me the idea to try the real call instead.

    Here is the git commit:
    http://mail-archives.apache.org/mod_mbox/incubator-callback-commits/201203.mbox/%3C20120307000809.B82AA5D82@tyr.zones.apache.org%3E

    Here is another thread on the problem:
    https://groups.google.com/forum/?fromgroups#!topic/phonegap/W32yYpV28W8

    UPDATE: I have some measure of success now:
    Edit your phonegap.js, comment out lines 3451-3453 which look like this:
    __proxyObj(navigator.geolocation, navigator._geo,…

    You will get an ugly permission alert.. but the location should work. The reasoning behind this change is that you will now use safari’s location detection, not PhoneGaps.

    UPDATE2: ..and the problem with PhoneGap turned out to be a conflict with another javascript library, in this case dragdealer.js. So double check for any suspicious variable names like “Location” or “Position” in any other javascript you are using. For some reason this conflict was not a problem on platforms other than iOS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I get this function to not only run on window resize but
Here's my code, it's based off the example provided at MDN: window.onload = function(){
Possible Duplicate: $(document).ready equivalent without jQuery I know you can use the window.onload event
I want a function to run when the document is ready , but there's
This is one script that sets the cookie with some html file. window.onload=init; function
I developed one swing application but each time you run application new window is
Say I have written a Create Table script in a query window and run
I can't run an simple XNA window in fullscreen when I have hooked up
I've run into an issue with opening a new window in safari (both ipad
I'd like some Javascript code to run when the mouse leaves the browser window.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.