Failed to show status of the Location Sensor component

The sensor does not show me the false status

Steps to reproduce the issue: Add a block if the sensor is active in some label or notifier, wait for the true or false message


Expected Behaviour: It should show a message of “Please, enable your Location Sensor”, and the label should be false, nor should the map be updated

Actual Behaviour: When I have the location sensor deactivated, it still shows true

Android version: 5.1

Nota: I am doing something wrong?

1 Like

Apparently it is a problem with my device, probe with another constructor and it still gives me true. I’ll have to check on another Smartphone. Can someone tell me if I’m doing something wrong?

Well, I do not understand the truth … there are two modes of location ?. Because I put Set Location Sensor in False and the notifier is already visible and I do not update the map, but if I manually activate the sensor and start the app now it is giving false, but the sensor is activated … something does not fit here. …I do not know if it is because I use a grabber to my device and disable certain options that I do not know if they are activated or deactivated

Well … my solution was this: Take the Available Providers block of the LocationSensor component, and I throw three possible results:

  • (passive) = The sensor is deactivated

  • (gps passive gps) = The sensor is activated

  • (gps passive gps network) = The sensor is activated, and also improves the accuracy with the connection to the internet

That is all

1 Like

You know why it returns true all the time? Because it has a property in the Designer named Enabled.

1 Like

I have to get coordinates of my location but it shows latitude o and longitude zero

1 Like

It is because you have to manually activate the GPS, it is not possible to activate it from the app (or maybe you can do an Activity Action that does it). So the location is disabled. In Kodular there is only the option to activate and deactivate the GPS but so if you want or not to request permission to the application to use the GPS, but do not activate or deactivate it.

How Can I do That?

You have to ask the user to turn their location on. (Maybe via a notifier dialog).
Google Maps takes a similar approach. They show a dialog asking you to turn location on. If you agree, the location settings screen is opened (I’m talking about Android settings). The user can then turn on location from there. (You can open the location settings screen using the activity starter)

Due to security reasons, apps are not allowed to enable/disable location without the user’s consent.

1 Like

How can i use a progress dialog for “enable gps” and when the user enables the gps, it automatically dismisses progress dialog

You must have the app check whether it is activated or not, and the result chains the notification, only if it is deactivated.

I found a problem using GPS.

When I have it deactivated, program a notification that asks the user to activate the GPS. When I activate it he keeps asking me to activate the GPS. So I have to deactivate the GPS function from the Floating Geolocation Icon, and then activate it again so that it detects that the GPS is activated.

The problem arises in Android 8. Huawei Y7 (2018)

wrong attachment bro…

Wait … What … was what I sent? How embarrassing, how I sent the wrong video. :rofl:

SVID_20190808_200210_1.mp4 (1,1 MB)

i´m solved the problem with permissions, this block in intialization screen, in my case is GPS
PD: you can view wrong icon, i duplicate the blocks hahaha :sweat_smile: