Предоставил все разрешения приложению, но оно вылетает с ошибкой
java.lang.RuntimeException: kotlin.NotImplementedError: An operation is not implemented: Not yet implemented
Код MainActivity:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
MapKitFactory.setApiKey("cbbf8bd7-7a50-463e-bdf4-88de9138d009")
MapKitFactory.initialize(this)
setContentView(R.layout.activity_main)
mapView = findViewById(R.id.mapview)
mapView.map.move(CameraPosition(Point(55.383297, 39.035919), 17.0f, 150.0f, 30.0f),
Animation(Animation.Type.SMOOTH, 5f), null)
var mapkit:MapKit = MapKitFactory.getInstance()
requstLocationPermission()
var pribki = mapkit.createTrafficLayer(mapView.mapWindow)
pribki.isTrafficVisible = false
probkibut = findViewById(R.id.probkibut)
probkibut.setOnClickListener {
if(pribki.isTrafficVisible == false){
pribki.isTrafficVisible = true
probkibut.setBackgroundResource(R.drawable.bt)
}
else{
pribki.isTrafficVisible = false
probkibut.setBackgroundResource(R.drawable.bt1)
}
}
locationMapKit = mapkit.createUserLocationLayer(mapView.mapWindow)
locationMapKit.isVisible = true
locationMapKit.setObjectListener(this)
SearchFactory.initialize(this)
searchManager = SearchFactory.getInstance().createSearchManager(SearchManagerType.COMBINED)
mapView.map.addCameraListener(this)
searchEdit = findViewById(R.id.search_edit)
searchEdit.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH){
sumbitQuery(searchEdit.text.toString())
}
false
}
}
private fun requstLocationPermission(){
if(ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION)!= PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(this, arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_COARSE_LOCATION), 0)
return
}
}
override fun onStart() {
super.onStart()
MapKitFactory.getInstance().onStart()
mapView.onStart()
}
override fun onStop() {
mapView.onStop()
MapKitFactory.getInstance().onStop()
super.onStop()
}
override fun onObjectAdded(userLocationView: UserLocationView) {
locationMapKit.setAnchor(
PointF((mapView.width *0.5).toFloat(), (mapView.height *0.5).toFloat()),
PointF((mapView.width *0.5).toFloat(), (mapView.height *0.83).toFloat())
)
userLocationView.arrow.setIcon(ImageProvider.fromResource(this, R.drawable.searchn))
val picIcon = userLocationView.pin.useCompositeIcon()
picIcon.setIcon("icon", ImageProvider.fromResource(this, R.drawable.searchn), IconStyle().
setAnchor(PointF(0f, 0f))
.setRotationType(RotationType.ROTATE).setZIndex(0f).setScale(1f)
)
picIcon.setIcon("pin", ImageProvider.fromResource(this, R.drawable.searchn),
IconStyle().setAnchor(PointF(0.5f, 0.5f)).setRotationType(RotationType.ROTATE).setZIndex(1f).setScale(0.5f))
userLocationView.accuracyCircle.fillColor = Color.BLUE and -0x66000001
}
override fun onObjectRemoved(p0: UserLocationView) {
}
override fun onObjectUpdated(p0: UserLocationView, p1: ObjectEvent) {
}
override fun onSearchResponse(p0: Response) {
TODO("Not yet implemented")
}
override fun onSearchError(p0: Error) {
TODO("Not yet implemented")
}
override fun onCameraPositionChanged(
map: Map,
cameraPosition: CameraPosition,
cameraUpdateReason: CameraUpdateReason,
finished: Boolean
) {
if(finished){
sumbitQuery(searchEdit.text.toString())
}
}