Package com.yandex.mapkit

Interface MapKit

interface MapKit

Provides access to all services in the SDK.

Initialize the MapKit factory before using this class.

Примечание

MapKit holds listener/delegate objects by weak references. You need to have strong references to them somewhere in the client code.

Summary

Methods

Type and modifiers

Method and Description

void

setUserId(@NonNull java.lang.String id)
Sets the user id.

void

setLocationManager(@NonNull LocationManager locationManager)
Sets single global location manager that is used by every module in MapKit by default.

void

resetLocationManagerToDefault()
Resets the global location manager to a default one, that is a location manager that is created by mapkit.MapKit#createLocationManager() call.

void

onStart()
Notifies MapKit when the application resumes the foreground state.

void

onStop()
Notifies MapKit when the application pauses and goes to the background.

LocationManager

createLocationManager()
Creates a manager that allows to listen for device location updates.

LocationManager

createLocationManager(@NonNull LocationActivityType activityType)
Creates a manager that allows to listen for device location updates, uses activityType as a hint.

LocationSimulator

createLocationSimulator(@NonNull Polyline geometry)
Creates a suspended LocationSimulator object with the given geometry.

LocationSimulator

createLocationSimulator()
Creates a suspended LocationSimulator object.

DummyLocationManager

createDummyLocationManager()
Creates a manager that functions as a location proxy.

OfflineCacheManager

getOfflineCacheManager()
Returns a manager that handles offline maps, search index and road graph.

StorageManager

getStorageManager()
Returns a manager that handles disk size and IO errors.

TrafficLayer

createTrafficLayer(@NonNull MapWindow mapWindow)
Creates the traffic layer.

RoadEventsManager

createRoadEventsManager()
Creates a manager that allows to interact with road events.

RoadEventsLayer

createRouteRoadEventsLayer(@NonNull MapWindow mapWindow,
                           @NonNull StyleProvider styleProvider)

Creates the road events layer that will draw road events on the route.

UserLocationLayer

createUserLocationLayer(@NonNull MapWindow mapWindow)
Create layer with the user location icon.

java.lang.String

getVersion()
Returns the version of the MapKit bundle.

boolean

isValid()
Tells if this MapKit is valid or not.

Methods

setUserId

void setUserId(@NonNull java.lang.String id)

Sets the user id.

Don't use this method directly. Use MapKitFactory.setUserId instead

Parameters

id

User id is your own identifier for all mapkit requests


setLocationManager

void setLocationManager(@NonNull LocationManager locationManager)

Sets single global location manager that is used by every module in MapKit by default.

The provided location manager must have async implementation in it. Any location manager created by MapKit has async implementation. To provide your own source of location please use mapkit.location.DummyLocationManager. Application can change location manager at any moment, all MapKit modules will start receiving new location immediately.


resetLocationManagerToDefault

void resetLocationManagerToDefault()

Resets the global location manager to a default one, that is a location manager that is created by mapkit.MapKit#createLocationManager() call.


onStart

void onStart()

Notifies MapKit when the application resumes the foreground state.


onStop

void onStop()

Notifies MapKit when the application pauses and goes to the background.


createLocationManager

@NonNull
LocationManager createLocationManager()

Creates a manager that allows to listen for device location updates.


createLocationManager

@NonNull
LocationManager createLocationManager(@NonNull LocationActivityType activityType)

Creates a manager that allows to listen for device location updates, uses activityType as a hint.


createLocationSimulator

@NonNull
LocationSimulator createLocationSimulator(@NonNull Polyline geometry)

Creates a suspended LocationSimulator object with the given geometry.


createLocationSimulator

@NonNull
LocationSimulator createLocationSimulator()

Creates a suspended LocationSimulator object.

Geometry must be set manually.


createDummyLocationManager

@NonNull
DummyLocationManager createDummyLocationManager()

Creates a manager that functions as a location proxy.


getOfflineCacheManager

@NonNull
OfflineCacheManager getOfflineCacheManager()

Returns a manager that handles offline maps, search index and road graph.

Примечание

This feature is not available in the free MapKit version.


getStorageManager

@NonNull
StorageManager getStorageManager()

Returns a manager that handles disk size and IO errors.


createTrafficLayer

@NonNull
TrafficLayer createTrafficLayer(@NonNull MapWindow mapWindow)

Creates the traffic layer.


createRoadEventsManager

@NonNull
RoadEventsManager createRoadEventsManager()

Creates a manager that allows to interact with road events.


createRouteRoadEventsLayer

@NonNull
RoadEventsLayer createRouteRoadEventsLayer(@NonNull MapWindow mapWindow,
                                           @NonNull StyleProvider styleProvider)

Creates the road events layer that will draw road events on the route.

The class maintains a strong reference to the object in the 'styleProvider' parameter until it (the class) is invalidated.

Parameters

mapWindow

Map window to attach road events layer

styleProvider

Provides icons and styles for road events depending on their properties


createUserLocationLayer

@NonNull
UserLocationLayer createUserLocationLayer(@NonNull MapWindow mapWindow)

Create layer with the user location icon.


getVersion

@NonNull
java.lang.String getVersion()

Returns the version of the MapKit bundle.


isValid

boolean isValid()

Tells if this MapKit is valid or not.

Any other method (except for this one) called on an invalid MapKit will throw java.lang.RuntimeException. An instance becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.


Предыдущая
Следующая