jenraulerson / geo-location-javascript

Automatically exported from code.google.com/p/geo-location-javascript
1 stars 1 forks source link

android 1.5 geolocation support #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Android 1.5 uses the deprecated form of the position object - it returns it 
with Position.latitude and Position.longitude instead of 
Position.coords.latitude and Position.coords.longitude.  Therefore the returned 
object is not universally accessible. 

I have solved this on my own project by simply duplicating the conditional code 
you have for the W3C geolocation (ie navigator.geolocation) and it works just 
fine.  I just thought you might want to update the google gears portion.

Original issue reported on code.google.com by chefq...@gmail.com on 3 Apr 2011 at 7:14

GoogleCodeExporter commented 9 years ago
Can you post the correction that you made to get this to work?  I'm having a 
similar problem on later Android versions.

Original comment by Michael....@gmail.com on 6 Apr 2011 at 10:04

GoogleCodeExporter commented 9 years ago
On line 97:

                         else if(typeof(window.google)!="undefined" && typeof(google.gears)!="undefined")
                        {
                                provider=google.gears.factory.create('beta.geolocation');
                                pub.getCurrentPosition = function(successCallback, errorCallback, options)
                                {
                                        function _successCallback(p)
                                        {
                                                if(typeof(p.latitude)!="undefined")
                                                {
                                                        successCallback({timestamp:p.timestamp, coords: {latitude:p.latitude,longitude:p.longitude}});
                                                }
                                                else
                                                {
                                                        successCallback(p);
                                                }
                                        }
                                        provider.getCurrentPosition(_successCallback,errorCallback,options);
                                }

                        }

Original comment by chefq...@gmail.com on 6 Apr 2011 at 10:10

GoogleCodeExporter commented 9 years ago
will look at it and post tomorrow. promise

Original comment by whoiss...@gmail.com on 6 Apr 2011 at 10:54

GoogleCodeExporter commented 9 years ago
Thanks so much both of you!

Original comment by Michael....@gmail.com on 7 Apr 2011 at 12:41

GoogleCodeExporter commented 9 years ago
checked in the change, thanks for the feedback. for some reason the new release 
upload wasn't working. file is attached. please try and let me know

Original comment by whoiss...@gmail.com on 11 Apr 2011 at 11:49

Attachments:

GoogleCodeExporter commented 9 years ago
Works great, thanks!

Original comment by chefq...@gmail.com on 17 Apr 2011 at 8:33