Question

I am working my way through the following LiveCode lessons-

http://lessons.runrev.com/s/lessons/m/4069/l/30379-how-do-i-get-the-location-and-use-the-digital-compass

but when I try and check the location sensor of my device with-

mobileSensorAvailable("location")

it returns false (not supported)

I am using a Galaxy S3 which has in-built GPS, so this should work.

Was it helpful?

Solution

Using mobileSensorAvailable will return if a named sensor is available or not. The sensors that you can currently check for from within LiveCode are-

  • Location - the location sensor of the device

  • Heading - the heading sensor of the device

  • Acceleration - the acceleration sensor of the device

  • Rotation rate - the rotation sensor of the device

You are correct in saying that your device has in-built GPS capabilities but in the case of Android deployment, you have to ensure that you have checked the required "Application Permissions" in order for the sensor to be detected These can be found in your applications "Standalone Application Settings". Namely, these are "Fine" and/or "Coarse Location".

The main differences between the two are -

  • Fine Location is required if you wish to use GPS to triangulate device location (requires course location)

  • Coarse location is required if you wish to use mobile networks to triangulate device location

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top