Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Turning GPS Hardware On
Started by mctrigg Oct 15 2016 04:48 PM

2 replies to this topic
gps hardware turning on
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

mctrigg

[GLOBAL: userInfoPane.html]
mctrigg
  • Observer

  • 2 posts
  • Corona SDK

I have compiled and installed an Android version of the following Corona SDK sample application (using CoronaSDK-2016.2949 with Sublime Text 3):

 

C:\Program Files (x86)\Corona Labs\Corona SDK\Sample Code\Hardware\GPS

 

When I install the application it requests the following during installation:

 

Do you want to install this application? It will get access to:

 

Privacy

approximate location (network-based)

precise location (GPS and network-based)

 

If the GPS is turned off on my phone before installing this application (settings -> Location = Off), this GPS sample application does not turn the GPS on, even after I agree to the above request.

 

Could someone please tell me how you programmatically turn on the GPS with Corona SDK?

 

Thank you.



[TOPIC: post.html]
#2

Perry Clarke

[GLOBAL: userInfoPane.html]
Perry Clarke
  • Moderator

  • 850 posts
  • Corona Staff

Apps cannot turn GPS on and off on Android (or iOS for that matter) as that is a user controlled setting.  The permission that is being requested is for access to the GPS but if the user turns the GPS off in settings then getting such permission isn't helpful.

 

Historically there have been unofficial workarounds for this but they mostly stopped working in Android 4 or required rooted phones and would probably result in an app being removed from the Play Store if reported to Google.



[TOPIC: post.html]
#3

mctrigg

[GLOBAL: userInfoPane.html]
mctrigg
  • Observer

  • 2 posts
  • Corona SDK

An Android application which does request permission and then turns the GPS hardware on is the Google maps app. If you turn your location off (Settings - Location = off) and then open up the Google maps app, it requests the following:

 

Use location?

 

This app wants to change your device settings:

 

Use GPS, Wi-Fi, and cell networks for location

 

NO YES

 

If it is a security restriction is this just a special case for the Google maps app? Why is it they can do it but no one else can? Because Android is their OS?

 




[topic_controls]
[/topic_controls]