Accessing location setting, only if location sensor is disabled

Hi,

To use bluetooth connection, i need to active location sensor.
With an activity starter, I could access the location setting.

but, just for avoiding duplication work,
what I want to do is that only if the location sensor is disabled,
access the location setting by push a button.

The following code is my algorithm structure.

If you know how to get the location sensor activation information,
Please let me know that

Thanks,

bluetooth location

Location Settings on an Android can only be set manually. The above code will show the appropriate Android Settings screen.

Thank you for your answer,

There is no way to check that location sensor is state(on/off)
before i set the location sensor manually?

I know that now we can only set the location sensor manually,
but i check whether it is on/off before executing setting screen.

Thanks,

StackOverflow indicates a possible way to check the status of the Location settings https://stackoverflow.com/questions/10311834/how-to-check-if-location-services-are-enabled . They provide a Java solution. I do not think this will work with App Inventor (but you could try and let us know)

set LocationSensor.Enabled only will have an effect if the device Location Setting is set to allow the gps to work.

Thank you for your notifying.
I found that "locationSensor.HasAccuracy" is proper to check the location sensor setting.

However, "HasAltitude, HasLongitude, HasLatitude" are not worked without individual gps setting.
It would be related with security issue of location sensor as you mentioned above.

Following is my worked code structure for S10.


Thanks,

1 Like