Controlling GPS ON/OFF from the app - android

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.

Related

Prompt to turn on device GPS in PWA

After going through tons of literature related to Geolocation in PWA, I am not sure whether this is possible but is there a mechanism for prompting the user to turn on device GPS in PWA?
What I am hoping to do is a solution similar to https://ionicframework.com/docs/native/location-accuracy/.
While the decision to turn on GPS is with the user, a prompt will help them to easily make the decision. I have gone through lot of tutorials and docs but haven't found anything yet. Please share your thoughts.
You can show a prompt that explains the benefits if you activate the geolocation, and if the user agrees there to make the request for geolocation in the background.
If your intention is to implement it on the web, you could check this plugin also that is compatible with Native and PWA.
https://ionicframework.com/docs/native/geolocation/
More info: https://developers.google.com/web/fundamentals/native-hardware/user-location/

How to get alert for turning on location services? [duplicate]

Recently my ola cabs application, after the latest update, asked for location permission at runtime. It did not open the location settings screen but just by clicking on yes, my location (GPS) of the device was turned on and the application proceeded without going to location settings or any settings screen. This feature was about to come in android M and is available on the MNC preview only, so I am guessing it cannot be used in devices at this point of time. So how is this application implementing this feature?
It is using SettingsApi in the Play Services SDK 7.0+, to display the location settings dialog.

Android show android natice pop up settings/cancel to enable location service

I am working on an android application that uses geo location services, when the user accesses such service if location access is disabled on the device i want to call android native pop up that guides user to enabled location access. Is it possible to do this ?
I noticed there's even better way to achieve good location settings, without "guiding" user to turn them on, mentioned in this question:
Enabling Location with mode High Accuracy or Battery saving without user needing to visit Settings
Since Google Play Services 7.0 you can ask system to offer user turning the settings on with one touch. It's how Google Maps are doing it.

GPS status in phonegap

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.

Get location of android device automatically

I'm working on an android app and i need to know the location of android device. All the methods I tried need GPS to be enabled. If it is not enabled, we can ask the user to turn it on by opening settings intent.
Is there any way to enable it via code, without even letting the user know.. and turn it off when the app has finished its job?
The app I'm working on will keep record of location of device. It will run in background and will note location every 15mins. To keep GPS enabled all the time will consume a lot of power. So i want to turn it on when i need and turn it off when i'm done, without asking the user.
For exact location, you need GPS to be enabled. But you can use NETWORK_PROVIDER, and get the latitude and longitude. This does not require user intervention. But, of course, its an approximate location but good enough to do location based searches.
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0,
locationListener);
For privacy reasons, that will never be possible without rooting the device.
You cannot get the user's location without consent.
Is there any way to enable it via code, without even letting the user know.. and turn it off when the app has finished its job?
Fortunately, no, for obvious privacy and security reasons.
So i want to turn it on when i need and turn it off when i'm done, without asking the user.
On and off are not the same as enabled and disabled.
Just because the user has allowed GPS to be enabled does not mean that it is drawing power. Only if an app has requested location data will the GPS radio be turned on. So, you cannot enable GPS (only users can), but you can arrange for GPS to be turned on if it is enabled. The user will still see an icon in the status bar when GPS is on.
How does the spy apps and all do that then?
They require that GPS be enabled by the user.

Categories

Resources