mapLocation

Type Event
Revision Release 2022.3683
Keywords mapLocation
See also map:requestLocation()
map:getUserLocation()
mapAddress
mapMarker

Overview

The mapLocation event is generated asynchronously in response to calling map:requestLocation() or in response to a tap event on the Map.

Gotchas

Properties

Example

local function mapLocationListener( event )
    print( "The tapped location is in: " .. event.latitude .. ", " .. event.longitude )
end

-- Create a native map view
local myMap = native.newMapView( 20, 20, 300, 220 )

-- Initialize map to a real location since default location (0,0) is not very interesting
myMap:setCenter( 37.331692, -122.030456 )
myMap:addEventListener( "mapLocation", mapLocationListener )