One of the unique features of mobile applications is location awareness. Mobile users bring their devices with them everywhere, and adding location awareness to your app offers users a more contextual experience.
Work with location data
The location data available to an iOS device includes the current location of the device — pinpointed using a combination of technologies — the direction and method of movement, and whether the device has moved across a predefined geographical boundary, or geofence.
The
myLocationEnabled
class of the GMSMapView
class controls whether the My Location dot is enabled.
If enabled, the
myLocation
method of the GMSMapView
class reveals where the device location dot is being
drawn.
Location permissions
Your app must prompt the user for consent to use location services. To do this,
include the NSLocationAlwaysUsageDescription
key in the Info.plist
file for
the app, and set the value of each key to a string that describes how the app
intends to use location data.
Code samples
The following tutorial and code sample demonstrate the use of location on a map:
The maps-sdk-for-ios-samples repository on GitHub also includes samples that demonstrate the use of location data.