Gps enabled / disabled, but does it work?

I am studying an app that includes LocationSensor
Via commands blocks the gps is enabled and disabled (LocationSensor.enable=true / false)
When the GPS is disabled, the symbol in the upper right corner of phone display, indicating the presence of the active GPS, disappears
But, if I look to the settings (wifi, bt, vert / horiz, gps, …) I see that the gps symbol is still active
Same thing if I start the app for position detection, and the gps in the settings is off, the app does not seem to activate it
The question is: does the LocationSensor.enable property turn on the gps peripheral hardware module or not?
I ask this because I would need to reduce consumption at certain times and having the GPS always on does not allow me to reach the goal

The devices location settings can only be set manually.

The LocationSensor.Enabled = true or false disables the LocationSensor component from
actively using the GPS receiver. It does not deactivate the devices ability to use the GPS receiver (it cannot programably turn it off or on.)

If the GPS is activated manually, it stays on until the USER changes the Android Settings to deactivate it. To deactivate use of the receiver, uncheck in the Settings Location sources Use GPS satellites…

LocationSettings
(The actual screen appears differently on different Android OS versions.)

Yes, the USER must turn the GPS receiver on or off manually and it can only be controlled manually.

Regards,
Steve

how to open the settings for the user to enable GPS see the example app "Get Available SSIDs" here App Inventor Extensions: WiFi | Pura Vida Apps

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

ActivityStarterIntents to use an intent to display the Android Settings screen. A USER must manually make his/her selections.

Actually, this is all the code necessary to evoke the Location Settings screen.


The Extras blocks only work on older Androids.

1 Like

does it worked for anybody? :thinking:
as far as I have seen, it was no one's solution!

Did you try the code Arman? Discussions are not always marked with a Solution even though suggested code works. :wink:

1 Like

result:

Error 601: No corresponding activity was found

What exactly dd you test @Arman and which device/Android version did you use for your tests?

Taifun

Galaxy A10s, all of the orders in @SteveJG's post is done

Did you try this and read the note?

1 Like

This is what I get on my Samsung A13 Android 10.

:wink:

Yes, the screen on Android 13 is different from Android 4

yes.

location permission is allowed :grinning: now what is the problem?

what is this? It was you who was reporting an issue with these blocks to open the Locations settings screen... now not anymore?

Taifun

I'm confused :woozy_face: what is the problem here? :hot_face:

You reported this error.
Later you said

So it looks like the example is working as expected also for you, isn't it?

Taifun

that is weird! even though I didn't make any changes to my blocks, I no longer get the previous error! how is it possible?

wait a minute, forgot what the discussion was about? If the user's location was not turned on, the app was supposed to ask the user to turn it on every time instead of going to the settings page, and if the user did not turn it on, he/she could not start the app!

@Arman The Android Location settings can ONLY be set manually per Google security precautions.