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

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.

Related

How apps are getting locations when Background Restrictions are turned on?

Some android devices have options to restrict apps in the background to save battery consumption. If I will turn on this option, my app and its background service will be killed. Some apps like Uber, Careem etc are using google services to get location of driver, to track driver.
I tested Uber Driver app, I turned on this option, and then killed the Uber Driver app. Location of driver was not updating, from pickup to drop off, location of driver was not updated. When I opened the driver's app to end the ride, location of driver updated, and whole distance was calculated accurately.
My question is this, if app is restricted to be used and killed, then on opening app, from where it gets all the locations, how Uber app knows the travelled distance?
Please have a look on attached images, devices have options like these:

Android - Appium's mocked location will be overwritten by Wi-Fi, Bluetooth and mobile networks

Within my Appium tests for an Android app I am using Appium's setLocation() of AndroidDriver to mock a location. This works properly, but since the app is requiring "High Accuracy" as location method the mocked location will be overwritten after a few seconds by the location which is generated by Wi-Fi, Bluetooth and mobile networks.
Is there any solution or workaround for this kind of issue? I want to set the location permantly (for the whole duration of the test), but can't change that the app is forcing the user to enable "High accuracy" mode.
Btw: I'm testing on a lot of different real devices and not on emulators.
First enable developer option in your phone.
Go to your phone Settings > About > Tap Rapidly on Build Number until it says “You are now a developer.”
Then go into your Developer Setting and check Allow mock locations.
Now you need to Download App that will allow you to fake the GPS location. There are several different apps that can do this. You can find free app in play store.
Finally you can select a random spot somewhere in the world and activate the fake location using the app.

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.

Google map is enabling GPS programmatically?

I noticed that with the new update to google map, if you have GPS is off, then it warns you about the accuracy. Here is the new thing, if you hit OK then it enables the GPS for you. Which means it is programmatically enabling GPS as opposed to me going to Settings. I have Kitkat running on samsung S4
Does this means that there is an official way to enable GPS programatically?IF yes then how?
Thanks
Google Play service 7.0 and above have this feature.
In Google Play services 7.0, we’re introducing a standard mechanism to
check that the necessary location settings are enabled for a given
LocationRequest to succeed. If there are possible improvements, you
can display a one touch control for the user to change their settings
without leaving your app.
http://android-developers.blogspot.in/2015/03/google-play-services-70-places-everyone.html

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.

Categories

Resources