object.isLocationVisible

Type Boolean
Object Map
Library native.*
Revision Release 2024.3703
Keywords isLocationVisible

Overview

A read-only Boolean value indicating whether the user’s current location is visible within the area currently displayed on the map. This is based on an approximation, so it may be that the value is true when the user’s position is slightly offscreen.

This property will always be false if the current location is unknown.

Gotchas

In order to access current location on Android, you must set the following permissions in the build.settings file.

settings =
{
    android =
    {
        usesPermissions =
        {
            -- Permission to retrieve current location from the GPS.
            "android.permission.ACCESS_FINE_LOCATION",

            -- Permission to retrieve current location from WiFi or cellular service.
            "android.permission.ACCESS_COARSE_LOCATION",
        },
    },
}

Example

local isLocVisible = myMap.isLocationVisible