Failed to show status of the Location Sensor component

(Marlon Rodríguez) #1

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
(Marlon Rodríguez) #2

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?

(Marlon Rodríguez) #3

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

(Marlon Rodríguez) #4

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

(anon3837068) #5

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

1 Like
(Qaiser Farooq) #6

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

(Marlon Rodríguez) #7

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.

(Qaiser Farooq) #8

How Can I do That?

(Vishwas Adiga) #9

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.