MapKit Mobile SDK
  • About MapKit
  • Android
    • Getting started
    • Tutorials
    • Class references
      • world.mappable.mapkit
      • world.mappable.mapkit.annotations
      • world.mappable.mapkit.directions
      • world.mappable.mapkit.directions.driving
      • world.mappable.mapkit.geometry
      • world.mappable.mapkit.geometry.geo
      • world.mappable.mapkit.images
      • world.mappable.mapkit.layers
      • world.mappable.mapkit.location
      • world.mappable.mapkit.logo
      • world.mappable.mapkit.map
      • world.mappable.mapkit.mapview
      • world.mappable.mapkit.navigation
      • world.mappable.mapkit.navigation.automotive
      • world.mappable.mapkit.navigation.automotive.custom_route_navigation
      • world.mappable.mapkit.navigation.automotive.layer
      • world.mappable.mapkit.navigation.automotive.layer.styling
      • world.mappable.mapkit.navigation.automotive.simulation
      • world.mappable.mapkit.navigation.balloons
      • world.mappable.mapkit.navigation.guidance_camera
      • world.mappable.mapkit.offline_cache
      • world.mappable.mapkit.personalized_poi
      • world.mappable.mapkit.places
      • world.mappable.mapkit.places.mrc
      • world.mappable.mapkit.places.panorama
      • world.mappable.mapkit.road_events
      • world.mappable.mapkit.road_events_layer
      • world.mappable.mapkit.search
      • world.mappable.mapkit.search.search_layer
      • world.mappable.mapkit.storage
      • world.mappable.mapkit.styling
      • world.mappable.mapkit.tiles
      • world.mappable.mapkit.traffic
      • world.mappable.mapkit.transport
      • world.mappable.mapkit.transport.bicycle
      • world.mappable.mapkit.transport.masstransit
      • world.mappable.mapkit.transport.time
      • world.mappable.mapkit.uri
      • world.mappable.mapkit.user_location
      • world.mappable.runtime
      • world.mappable.runtime.config
      • world.mappable.runtime.i18n
      • world.mappable.runtime.image
      • world.mappable.runtime.network
      • world.mappable.runtime.ui_view
      • world.mappable.runtime.view
  • iOS
  • Flutter
  • Map styles
  • Technical support

Package world.mappable.mapkit.location

Interface LocationManager

All known Subinterfaces:

DummyLocationManager, LocationSimulator

interface LocationManager

Handles location updates and changes.

Summary

Methods

Type and modifiers

Method and Description

void

subscribeForLocationUpdates(double desiredAccuracy,
                            long minTime,
                            double minDistance,
                            boolean allowUseInBackground,
                            @NonNull FilteringMode filteringMode,
                            @NonNull Purpose purpose,
                            @NonNull LocationListener locationListener)

Subscribe for location update events.

void

requestSingleUpdate(@NonNull LocationListener locationListener)
Subscribe to a single location update.

void

unsubscribe(@NonNull LocationListener locationListener)
Unsubscribe from location update events.

void

suspend()
Stops updates for all subscriptions until resume() is called.

void

resume()
Resumes updates stopped by a suspend() call.

Methods

subscribeForLocationUpdates

void subscribeForLocationUpdates(double desiredAccuracy,
                                 long minTime,
                                 double minDistance,
                                 boolean allowUseInBackground,
                                 @NonNull FilteringMode filteringMode,
                                 @NonNull Purpose purpose,
                                 @NonNull LocationListener locationListener)

Subscribe for location update events.

If the listener was already subscribed to updates from the LocationManager, subscription settings will be updated. Use desiredAccuracy = 0 to obtain best possible accuracy, minTime = 0 to ignore minTime and use minDistance instead, minDistance = 0 to use only minTime. If both minTime and minDistance are set to zero, the subscription will use the same settings as other LocationManager clients.

The class does not retain the object in the 'locationListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.

Parameters

desiredAccuracy

Desired location accuracy, in meters. This value is used to configure location services provided by the host OS. If locations with the desired accuracy are not available, updates may be called with lower accuracy.

minTime

Minimal time interval between events, in milliseconds.

minDistance

Minimal distance between location updates, in meters.

allowUseInBackground

Defines whether the subscription can continue to fetch notifications when the application is inactive. If allowUseInBackground is true, set the location flag in UIBackgroundModes for your application.

filteringMode

Defines whether locations should be filtered.

purpose

Defines whether locations will be used for navigation.

locationListener

Location update listener.


requestSingleUpdate

void requestSingleUpdate(@NonNull LocationListener locationListener)

Subscribe to a single location update.

If the listener was already subscribed to location updates, the previous subscription will be removed.

The class does not retain the object in the 'locationListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.

Parameters

locationListener

Location update listener.


unsubscribe

void unsubscribe(@NonNull LocationListener locationListener)

Unsubscribe from location update events.

Can be called for either [mapkit.location.LocationManager#subscribeForLocationUpdates(double,
long, double, boolean, FilteringMode, Purpose, LocationListener)](./LocationManager.md#subscribeforlocationupdatesdouble-
long-double-boolean-filteringmode-purpose-locationlistener) or mapkit.location.LocationManager#requestSingleUpdate(LocationListener). For mapkit.location.LocationManager#requestSingleUpdate(LocationListener), if an event was already received, mapkit.location.LocationManager#unsubscribe(LocationListener) does not have any effect. If the listener is already unsubscribed, the method call is ignored.

The class does not retain the object in the 'locationListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.

Parameters

locationListener

Listener passed to either [mapkit.location.LocationManager#subscribeForLocationUpdates(double,
long, double, boolean, FilteringMode, Purpose, LocationListener)](./LocationManager.md#subscribeforlocationupdatesdouble-
long-double-boolean-filteringmode-purpose-locationlistener) or mapkit.location.LocationManager#requestSingleUpdate(LocationListener).


suspend

void suspend()

Stops updates for all subscriptions until resume() is called.


resume

void resume()

Resumes updates stopped by a suspend() call.