Location Component
The Location Component provides location awareness to your mobile application. Enabling this component provides a contextual experience to your users by showing an icon representing the users current location. A few different modes are offered to provide the right context to your users at the correct time. NORMAL simply shows the users location on the map represented as a dot. COMPASS mode allows you to display an arrow icon (by default) that points in the direction the device is pointing in. GPS can be used in conjunction with our Navigation SDK to display a larger icon (customized with gpsDrawable) we call the user puck.
This component also offers the ability to set a map camera behavior for tracking the user location. These different CameraModes will track, stop tracking the location based on the mode set with setCameraMode.
To get the component object use getLocationComponent and activate it with activateLocationComponent. Then, manage its visibility with setLocationComponentEnabled. The component will not process location updates right after activation, but only after being enabled.
Using this component requires you to request permission beforehand manually or using PermissionsManager. Either ACCESS_COARSE_LOCATION
or ACCESS_FINE_LOCATION
permissions can be requested for this component to work as expected.
This component offers a default, built-in LocationEngine called MapLibreFusedLocationEngineImpl. If you'd like to utilize the previously available Google Play Services for more precise location updates, refer to the migration guide of 10.0.0 in the changelog. After a custom engine is passed to the component, or the built-in is initialized, the location updates are going to be requested with the LocationEngineRequest, either a default one, or the one passed during the activation. When using any engine, requesting/removing the location updates is going to be managed internally.
You can also push location updates to the component without any internal engine management. To achieve that, set `useDefaultLocationEngine` in LocationComponentActivationOptions to false. No engine is going to be initialized and you can push location updates with forceLocationUpdate.
For location puck animation purposes, like navigation, we recommend limiting the maximum zoom level of the map for the best user experience.
Location Component doesn't support state saving out-of-the-box.