Cordova Geolocation works really well when GPS is enabled. If the app is launched with GPS enabled, then GPS is disabled, and then re-enabled... everything works as expected. If, however, I start with GPS disabled, there is absolutely nothing to be done but to restart with GPS enabled. Enabling GPS while the app is running has no effect, and there appears to be no way to retrieve the position. I've tried with both pure Cordova and mdg:geolocation Meteor package... same result.
Tested on Android
Have you considered to ask if your gps is enable before and then try to enable it automatically or ask the user to change the Location Settings?
I had recommended a Plugin to do this here:
Cordova Angularjs ask for GPS
Related
I am working on an Cordova application using ionic.
I need user's coordinates for which I am using HTML5 geolocation API which does a graceful degradation if the best source isn't available. I have also added the cordova geolocation plugin that adds a global navigator object if not present. My app asks permission to use geolocation when I install the APK as well but it still gives me a location based on my network when my GPS is off.
I want to be able to ask user to switch on the GPS. How do I accomplish this. I am very new to HTML5 development for mobile.
I think this will help you
https://github.com/mablack/cordova-diagnostic-plugin
I think the Geolocation API does not give you an error if the GPS is on/off, just a timeout error if it is not able to get a lock in the time limit you specify, but I tested it a while ago and I might be mistaking.
I am new in Phonegap. I want show user location via network or GPS. I want to know GPS status, like GPS now is off or enable or disable? And if GPS is off, the app go to settings for on GPS, if GPS is disable, GPS be on. I don't know, Can i find this with phonegap or should write a plugin for this? I mean, i should write a plugin for android and another plugin for IOS?
Thanks for your help :)
There is a plugin for Android here and another here
on iOS, the error callback will tell you the location services are disabled if that is the reason it was not able to locate.
Is there a recognized problem with geolocation via the default browser in Android 2.3.4 Gingerbread?
On an HTC G2 android 2.3.4, the default browser does not appear to use the GPS satellites to determine location. As a result, the location the browser sends to the app is off by a mile or so. Yes, the GPS and wi-fi were both on in the phone. We turned wi-fi off and got the same (bad) result.
Is there some voodoo that can be done to get the default browser in 2.3.4 to do proper geolocation?
On an iPhone 3s geolocation with the very same browser app works perfectly. The following link starts the Gmap4 app (I am the developer) and shows your location on the Google 'Hybrid" map:
http://www.mappingsupport.com/p/gmap4.php?mylocation=on
I believe this is not a browser problem, but a phone specific issue. If you are getting a position off by a mile, for sure the position has been acquired from wifi.
When you start the map, it tries to get the LastKnownLocation, and if it's to old it reverts to wifi position. Now, if you turn wifi off, the position acquiried using wi-fi will remain available as a recent LastKnownLocation and will be used to position the map again.
Until you get a better position from GPS this one will be used.
At least some phones discard the LastKnownLocation when you restart them. You can try it, with wifi off, to see what happens.
Regards.
I want to turn on the Network Location ("Wireless networks" - Location determined by Wi-fi and/or mobile networks). Is this possible?
In my application, I can force 3g connection (only in Android 2.3+, I have problems with WRITE_SECURE_SETTINGS on Android 2.2) and GPS Location.
Thanks,
You can do it via root methods if you must, however, I would recommend prompting the user in most cases.
See Android get location or prompt to enable location service if disabled for prompting. I'm really not sure about the root method but it is documented somewhere on the XDA-Forums I'm sure.
I have a working code to get the current location using GPS. However it stopped working suddenly. On further debugging using GpsStatusListner, I noticed Satellite count is always 0 (before it used to show upto 8/9 sats).
And other navigation software (google navigator, At&t navigator) none of them are able to get fix on GPS.
Is there a way to reset/reccaliberate the GPS component in my phone? I tried disabling/enabling GPS/Network under Location settings and rebooted the phone multiple times :(
Device: HTC Inspire.
thank you!
Ok many had this problem
Make sure gps is disabled
Go to the market
Download "Fast Reboot"
Run it
Run navigation (when it's done)
It'll ask you to show location settings
Click okay
Enable gps
Open navigation again
it should work