You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Shazron Abdullah (JIRA)" <ji...@apache.org> on 2013/04/23 00:45:15 UTC

[jira] [Resolved] (CB-3053) Geolocation API sometimes returns outdated GPS coordinates when called after resume event

     [ https://issues.apache.org/jira/browse/CB-3053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shazron Abdullah resolved CB-3053.
----------------------------------

    Resolution: Not A Problem

Reviewed the native code - it is sound, we are reporting whatever iOS gives back to us, so your problem may be internal to iOS itself.
                
> Geolocation API sometimes returns outdated GPS coordinates when called after resume event
> -----------------------------------------------------------------------------------------
>
>                 Key: CB-3053
>                 URL: https://issues.apache.org/jira/browse/CB-3053
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 2.5.0, 2.6.0
>         Environment: iOS 6. Tested in simulator & iPhone 4
>            Reporter: Kuan Yi Ming
>            Assignee: Shazron Abdullah
>             Fix For: 2.7.0
>
>
> On iOS, calling getCurrentPosition after resuming the app from the background sometimes will return the old coordinates from an earlier getCurrentPosition call prior to backgrounding the app.
> Tested on simulator and on an iPhone 4.
> On the simulator, this happens all the time. On a physical device, it can be replicated the first handful of calls but not after that (may have something to do with not getting GPS satellite lock right away?)
> This is probably only iOS specific as this can't be replicated whatsoever on a Galaxy Nexus with Location Services turned on, but GPS satellites are disabled.
> Javascript code:
> {code}
> function onBodyLoad(){
>     document.addEventListener("deviceready", onDeviceReady, false);
> }
> function onDeviceReady(){
>     document.addEventListener("resume", onResume, false);
>     navigator.geolocation.getCurrentPosition(onGetFollowMeSuccess, onGetFollowMeError);
> }
> function onResume(){
>     navigator.geolocation.getCurrentPosition(onGetFollowMeSuccess, onGetFollowMeError);
> }
> function onGetFollowMeSuccess(position){
>     alert("Lat: " + position.coords.latitude + ", Long: " + position.coords.longitude);
> }
> function onGetFollowMeError(){
>     alert("Whoops-a-daisy.");
> }
> {code}
> HTML code:
> {code}
> <!DOCTYPE html>
> <html>
>     <head>
>         <title>Geo Loco</title>
>         <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
>         <meta charset="utf-8" />
>         <script type="text/javascript" charset="utf-8" src="cordova-2.6.0.js"></script>
>         
>         <script type="text/javascript" charset="utf-8" src="main.js"></script>
>     </head>
>     
>     <body onload="onBodyLoad()">
>         Geo Loco
>     </body>
> </html>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira