GPS status in phonegap - android

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.

Related

Controlling GPS ON/OFF from the app

I am seeking for some advice from the Corona experts. I would like to control GPS ON/OFF from my app but I am not quite sure that can be achieved by using Corona.
I have couple of queries about the process-
After installing the app and then open, the app will prompt for enabling GPS (if that turned OFF on that device and sharing location permission is already given), am I right?
If the sharing location permission denied by the user then can the app will be able to ask for permission again and prompt for enabling the GPS?
If I turn ON the GPS from my app settings and then again turn OFF, then it is possible to show popup notification message to turn on the GPS?
Someone said that it only display the permission notification prompt message once and after that no way to show the prompt message to control the location service.
Looking forward to get some expert advice.
Thanks in advance!
You cannot do any of these with Corona SDK. You will need Enterprise version to play with permissions and settings. Even then you have to code in Java not Corona.

Cordova Geolocation : app startup with GPS disabled

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

How do I ask user to switch on the GPS of the device?

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.

Android GPS and wifi Status In application

I have implemented Android GPS application and cell-id application for location tracing separately, now I want to combine the functionality of both the applications, I want to trace the location via GPS if wifi not available or vice verca. Kindly guide me how can I get the status of GPS and wifi.
http://developer.android.com/guide/topics/location/obtaining-user-location.html

Is every Android phone GPS Enabled or not?

I am developing a location based application but I am confused whether every Android phone has GPS enabled or not?
And if GPS is not available and if we use GPS settings API, then what is the result?
is any error or not..?
please help me..
Some android devices don't have a GPS.
For more informations on how to get the location of a user, you should read the Obtaining User Location section of the documentation : it contains quite of bit of notes and code samples.

Categories

Resources