<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer">74772</assigned-user-id>
  <attachments-count type="integer">0</attachments-count>
  <closed type="boolean">true</closed>
  <created-at type="datetime">2009-12-16T01:23:19-08:00</created-at>
  <creator-id type="integer">66846</creator-id>
  <milestone-due-on type="datetime" nil="true"></milestone-due-on>
  <milestone-id type="integer" nil="true"></milestone-id>
  <number type="integer">16</number>
  <permalink>navigatorgeolocation-does-not-make-use-of-gps-data</permalink>
  <priority type="integer">140893</priority>
  <project-id type="integer">20116</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>resolved</state>
  <tag>geolocation iphone</tag>
  <title>navigator.geolocation does not make use of GPS data</title>
  <updated-at type="datetime">2010-01-28T01:19:54-08:00</updated-at>
  <user-id type="integer">74772</user-id>
  <user-name>Jesse</user-name>
  <creator-name>Hugo</creator-name>
  <assigned-user-name>Jesse</assigned-user-name>
  <url>http://phonegap.lighthouseapp.com/projects/20116/tickets/16</url>
  <original-body>On the iPhone, navigator.geolocation references the Safari Geolocation API, not the  Geolocation() phonegap object. As a result, only Wifi &amp; cell tower triangulation data are being used to pinpoint the location (and the accuray these signals falls short of the accuracy from GPS - especially outside or urban areas)

Steps to reproduce (...short of walking on the countryside to compare accuracy with Phonagap app Vs maps):
1. In the sample application, add the following line to index.html's getLocation() function:
&lt;code&gt;debug.log(navigator.geolocation.watchPosition.toString());&lt;/code&gt;
2. Start the sample application, click the 'Get Location' button and check that you see this in the logs instead of the expected watchPosition() function defined in geolocation.js
&lt;code&gt;
function watchPosition() {
    [native code]
}
&lt;/code&gt;




Re: http://groups.google.com/group/phonegap/browse_thread/thread/32da55d81fc4a8ff#</original-body>
  <latest-body>On the iPhone, navigator.geolocation references the Safari Geolocation API, not the  Geolocation() phonegap object. As a result, only Wifi &amp; cell tower triangulation data are being used to pinpoint the location (and the accuray these signals falls short of the accuracy from GPS - especially outside or urban areas)

Steps to reproduce (...short of walking on the countryside to compare accuracy with Phonagap app Vs maps):
1. In the sample application, add the following line to index.html's getLocation() function:
&lt;code&gt;debug.log(navigator.geolocation.watchPosition.toString());&lt;/code&gt;
2. Start the sample application, click the 'Get Location' button and check that you see this in the logs instead of the expected watchPosition() function defined in geolocation.js
&lt;code&gt;
function watchPosition() {
    [native code]
}
&lt;/code&gt;




Re: http://groups.google.com/group/phonegap/browse_thread/thread/32da55d81fc4a8ff#</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;On the iPhone, navigator.geolocation references the Safari
Geolocation API, not the Geolocation() phonegap object. As a
result, only Wifi &amp;amp; cell tower triangulation data are being
used to pinpoint the location (and the accuray these signals falls
short of the accuracy from GPS - especially outside or urban
areas)&lt;/p&gt;
&lt;p&gt;Steps to reproduce (...short of walking on the countryside to
compare accuracy with Phonagap app Vs maps):&lt;br&gt;
1. In the sample application, add the following line to
index.html's getLocation() function:&lt;br&gt;
&lt;code&gt;debug.log(navigator.geolocation.watchPosition.toString());&lt;/code&gt;&lt;br&gt;
2. Start the sample application, click the 'Get Location' button
and check that you see this in the logs instead of the expected
watchPosition() function defined in geolocation.js&lt;br&gt;
&lt;code&gt;&lt;br&gt;
function watchPosition() {&lt;br&gt;&lt;/code&gt;&lt;/p&gt;
{mkd-extraction-a764e38f28403e5ce435038db0d592a7}
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Re: &lt;a href=
&quot;http://groups.google.com/group/phonegap/browse_thread/thread/32da55d81fc4a8ff&quot;&gt;
http://groups.google.com/group/phonegap/browse_thread/thread/32da55...&lt;/a&gt;#&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>On the iPhone, navigator.geolocation references the Safari Geolocation API, not the  Geolocation() phonegap object. As a result, only Wifi &amp; cell tower triangulation data are being used to pinpoint the location (and the accuray these signals falls short of the accuracy from GPS - especially outside or urban areas)

Steps to reproduce (...short of walking on the countryside to compare accuracy with Phonagap app Vs maps):
1. In the sample application, add the following line to index.html's getLocation() function:
&lt;code&gt;debug.log(navigator.geolocation.watchPosition.toString());&lt;/code&gt;
2. Start the sample application, click the 'Get Location' button and check that you see this in the logs instead of the expected watchPosition() function defined in geolocation.js
&lt;code&gt;
function watchPosition() {
    [native code]
}
&lt;/code&gt;




Re: http://groups.google.com/group/phonegap/browse_thread/thread/32da55d81fc4a8ff#</body>
      <body-html>&lt;div&gt;&lt;p&gt;On the iPhone, navigator.geolocation references the Safari
Geolocation API, not the Geolocation() phonegap object. As a
result, only Wifi &amp;amp; cell tower triangulation data are being
used to pinpoint the location (and the accuray these signals falls
short of the accuracy from GPS - especially outside or urban
areas)&lt;/p&gt;
&lt;p&gt;Steps to reproduce (...short of walking on the countryside to
compare accuracy with Phonagap app Vs maps):&lt;br&gt;
1. In the sample application, add the following line to
index.html's getLocation() function:&lt;br&gt;
&lt;code&gt;debug.log(navigator.geolocation.watchPosition.toString());&lt;/code&gt;&lt;br&gt;
2. Start the sample application, click the 'Get Location' button
and check that you see this in the logs instead of the expected
watchPosition() function defined in geolocation.js&lt;br&gt;
&lt;code&gt;&lt;br&gt;
function watchPosition() {&lt;br&gt;&lt;/code&gt;&lt;/p&gt;
{mkd-extraction-a764e38f28403e5ce435038db0d592a7}
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Re: &lt;a href=
&quot;http://groups.google.com/group/phonegap/browse_thread/thread/32da55d81fc4a8ff&quot;&gt;
http://groups.google.com/group/phonegap/browse_thread/thread/32da55...&lt;/a&gt;#&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-09-10T14:07:29-07:00</created-at>
      <creator-id type="integer">66846</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">16</number>
      <permalink>navigatorgeolocation-does-not-make-use-of-gps-data</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">20116</project-id>
      <state>new</state>
      <tag>geolocation iphone</tag>
      <title>navigator.geolocation does not make use of GPS data</title>
      <updated-at type="datetime">2009-09-10T14:07:33-07:00</updated-at>
      <user-id type="integer">66846</user-id>
      <user-name>Hugo</user-name>
      <creator-name>Hugo</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://phonegap.lighthouseapp.com/projects/20116/tickets/16</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Unfortunately based on my tests, we cannot bind to &quot;navigator.geolocation&quot; to override UIWebView's default implementation in 3.0.
&lt;br /&gt;
If we want to enable PhoneGap geoloc, we will have to be bind to another property. The impact: addition of another API call, and Objective-C changes. &lt;br /&gt;
&lt;br /&gt;
Will need to discuss with the team about the impact.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Unfortunately based on my tests, we cannot bind to
&quot;navigator.geolocation&quot; to override UIWebView's default
implementation in 3.0.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
If we want to enable PhoneGap geoloc, we will have to be bind to
another property. The impact: addition of another API call, and
Objective-C changes.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Will need to discuss with the team about the impact.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-09-11T16:53:23-07:00</created-at>
      <creator-id type="integer">66846</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">16</number>
      <permalink>navigatorgeolocation-does-not-make-use-of-gps-data</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">20116</project-id>
      <state>new</state>
      <tag>geolocation iphone</tag>
      <title>navigator.geolocation does not make use of GPS data</title>
      <updated-at type="datetime">2009-09-11T16:53:28-07:00</updated-at>
      <user-id type="integer">64602</user-id>
      <user-name>Shazron Abdullah</user-name>
      <creator-name>Hugo</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://phonegap.lighthouseapp.com/projects/20116/tickets/16</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">74772</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Okay, until we decide how to refactor this with the least impact, I will post the workaround.

The js Geolocation object defined in phonegap.js functions correctly and was in use until the 3.0 update that added the same functionality to the navigator object, and overwrote the phonegap functionality.  You will not need to modify phonegap.js.

In your html/js code, create your own Geolocation object: ( define it in a global scope, so it can be accessed from Obj-C code.

@@@ javascript

// in js
var myLocation = new Geolocation();
myLocation.getCurrentPosition(onLocSuccess);
myLocation.start();

@@@

@@@ javascript

// in Obj-C -  Location.m ( in the commands folder )
// Replace the 2 calls to callback to javascript to use your js object :

NSString * jsCallBack = [NSString stringWithFormat:@&quot;myLocation.setLocation({ timestamp: %d, %@ });&quot;, epoch, coords];

// and

jsCallBack = [NSString stringWithFormat:@&quot;myLocation.setError(\&quot;%s\&quot;);&quot;,
                                 [error localizedDescription]
                                ];

@@@

Also: Note the case of Geolocation, I kept thinking it should be GeoLocation and hence stared blankly at my code for awhile when it didn't work.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Okay, until we decide how to refactor this with the least
impact, I will post the workaround.&lt;/p&gt;
&lt;p&gt;The js Geolocation object defined in phonegap.js functions
correctly and was in use until the 3.0 update that added the same
functionality to the navigator object, and overwrote the phonegap
functionality. You will not need to modify phonegap.js.&lt;/p&gt;
&lt;p&gt;In your html/js code, create your own Geolocation object: (
define it in a global scope, so it can be accessed from Obj-C
code.&lt;/p&gt;
&lt;pre&gt;
&lt;code class=&quot;javascript&quot;&gt;
// in js
var myLocation = new Geolocation();
myLocation.getCurrentPosition(onLocSuccess);
myLocation.start();&lt;/code&gt;
&lt;/pre&gt;
&lt;pre&gt;
&lt;code class=&quot;javascript&quot;&gt;
// in Obj-C -  Location.m ( in the commands folder )
// Replace the 2 calls to callback to javascript to use your js object :

NSString * jsCallBack = [NSString stringWithFormat:@&quot;myLocation.setLocation({ timestamp: %d, %@ });&quot;, epoch, coords];

// and

jsCallBack = [NSString stringWithFormat:@&quot;myLocation.setError(\&quot;%s\&quot;);&quot;,
                                 [error localizedDescription]
                                ];&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;Also: Note the case of Geolocation, I kept thinking it should be
GeoLocation and hence stared blankly at my code for awhile when it
didn't work.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-12-16T01:23:19-08:00</created-at>
      <creator-id type="integer">66846</creator-id>
      <diffable-attributes type="yaml">--- 
:assigned_user: 
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">16</number>
      <permalink>navigatorgeolocation-does-not-make-use-of-gps-data</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">20116</project-id>
      <state>new</state>
      <tag>geolocation iphone</tag>
      <title>navigator.geolocation does not make use of GPS data</title>
      <updated-at type="datetime">2009-12-16T01:28:02-08:00</updated-at>
      <user-id type="integer">74772</user-id>
      <user-name>Jesse</user-name>
      <creator-name>Hugo</creator-name>
      <assigned-user-name>Jesse</assigned-user-name>
      <url>http://phonegap.lighthouseapp.com/projects/20116/tickets/16</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">74772</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Ok, the PhoneGap team discussed it and found out there is workaround for this. Although navigator.geolocation CANNOT be overridden, the properties of the navigator.geolocation object CAN be overridden. 

So the fix is to override all the navigator.geolocation API functions with our old geolocation functions.

eg 
        var myGeo = new Geolocation();
        navigator.geolocation.getCurrentPosition = function()
        {
             myGeo.getCurrentPosition.apply(myGeo,arguments);
        }
        navigator.geolocation.setLocation = function()
        {
            myGeo.setLocation.apply(myGeo,arguments);
        }</body>
      <body-html>&lt;div&gt;&lt;p&gt;Ok, the PhoneGap team discussed it and found out there is
workaround for this. Although navigator.geolocation CANNOT be
overridden, the properties of the navigator.geolocation object CAN
be overridden.&lt;/p&gt;
&lt;p&gt;So the fix is to override all the navigator.geolocation API
functions with our old geolocation functions.&lt;/p&gt;
&lt;p&gt;eg&lt;br&gt;&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;    var myGeo = new Geolocation();
    navigator.geolocation.getCurrentPosition = function()
    {
         myGeo.getCurrentPosition.apply(myGeo,arguments);
    }
    navigator.geolocation.setLocation = function()
    {
        myGeo.setLocation.apply(myGeo,arguments);
    }&lt;/code&gt;
&lt;/pre&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-12-24T15:30:20-08:00</created-at>
      <creator-id type="integer">66846</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">16</number>
      <permalink>navigatorgeolocation-does-not-make-use-of-gps-data</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">20116</project-id>
      <state>new</state>
      <tag>geolocation iphone</tag>
      <title>navigator.geolocation does not make use of GPS data</title>
      <updated-at type="datetime">2009-12-24T15:30:21-08:00</updated-at>
      <user-id type="integer">64602</user-id>
      <user-name>Shazron Abdullah</user-name>
      <creator-name>Hugo</creator-name>
      <assigned-user-name>Jesse</assigned-user-name>
      <url>http://phonegap.lighthouseapp.com/projects/20116/tickets/16</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">74772</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2010-01-28T01:19:53-08:00</created-at>
      <creator-id type="integer">66846</creator-id>
      <diffable-attributes type="yaml">--- 
:state: new
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">16</number>
      <permalink>navigatorgeolocation-does-not-make-use-of-gps-data</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">20116</project-id>
      <state>resolved</state>
      <tag>geolocation iphone</tag>
      <title>navigator.geolocation does not make use of GPS data</title>
      <updated-at type="datetime">2010-01-28T01:19:54-08:00</updated-at>
      <user-id type="integer">74772</user-id>
      <user-name>Jesse</user-name>
      <creator-name>Hugo</creator-name>
      <assigned-user-name>Jesse</assigned-user-name>
      <url>http://phonegap.lighthouseapp.com/projects/20116/tickets/16</url>
    </version>
  </versions>
</ticket>
