[FAQ] 지도/로컬 API 문의 전 꼭 읽어 주세요.
https://devtalk.kakao.com/t/faq-api/125610
자꾸 참조에러가나서 MapView클래스 선언부로 이동해서 살펴보던도중
deprecated함수에 이게 있네요…
구글링을 통해서 필요한 내용을 찾고있다가 currentLocationTrackingMode 이게 나침반모드를 켜는거라고해서 사용해보려고했는데 이제 사용되지않는 함수면 이제 저걸 대체할 함수는 어떤게있는건가요?
아니면 제가 deprecated된거라고 잘못알고있는걸까요?
일단은 제 상황은 이렇습니다.
이런식으로 에러가 나고있는 상황이구요. OS는 윈도우10 사용중이구요 언어는 코틀린을 사용하고있습니다.
안드로이드 스튜디오는 최신버전 플라밍고 사용중입니다.
이건 코드 전문입니다.
package com.example.FoodAdventure.Activity
import android.os.Bundle
import android.view.ViewGroup
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.example.FoodAdventure.Activity.Splash.Companion.locationpos
import com.example.FoodAdventure.R
import com.example.FoodAdventure.databinding.ActivityMapBinding
import net.daum.mf.map.api.MapPOIItem
import net.daum.mf.map.api.MapPoint
import net.daum.mf.map.api.MapView
class MapActivity : AppCompatActivity() ,MapView.MapViewEventListener,MapView.CurrentLocationEventListener, MapView.POIItemEventListener {
private lateinit var binding: ActivityMapBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMapBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
val mapView = MapView(this)
val mapViewContainer = binding.mapview as ViewGroup
mapViewContainer.addView(mapView)
mapView.setMapViewEventListener(this)
mapView.setPOIItemEventListener(this)
mapView.setCurrentLocationEventListener(this)
val mapPoint = MapPoint.mapPointWithGeoCoord(locationpos.x!!, locationpos.y!!) //current my location
mapView.currentLocationTrackingMode(MapView.CurrentLocationTrackingMode.TrackingModeOnWithoutHeading)
}
override fun onMapViewInitialized(p0: MapView?) {
}
override fun onMapViewCenterPointMoved(p0: MapView?, p1: MapPoint?) {
}
override fun onMapViewZoomLevelChanged(p0: MapView?, p1: Int) {
}
override fun onMapViewSingleTapped(p0: MapView?, p1: MapPoint?) {
}
override fun onMapViewDoubleTapped(p0: MapView?, p1: MapPoint?) {
}
override fun onMapViewLongPressed(p0: MapView?, p1: MapPoint?) {
}
override fun onMapViewDragStarted(p0: MapView?, p1: MapPoint?) {
}
override fun onMapViewDragEnded(p0: MapView?, p1: MapPoint?) {
}
override fun onMapViewMoveFinished(p0: MapView?, p1: MapPoint?) {
}
override fun onCurrentLocationUpdate(p0: MapView?, p1: MapPoint?, p2: Float) {
}
override fun onCurrentLocationDeviceHeadingUpdate(p0: MapView?, p1: Float) {
}
override fun onCurrentLocationUpdateFailed(p0: MapView?) {
}
override fun onCurrentLocationUpdateCancelled(p0: MapView?) {
}
override fun onPOIItemSelected(p0: MapView?, p1: MapPOIItem?) {
}
override fun onCalloutBalloonOfPOIItemTouched(p0: MapView?, p1: MapPOIItem?) {
}
override fun onCalloutBalloonOfPOIItemTouched(
p0: MapView?,
p1: MapPOIItem?,
p2: MapPOIItem.CalloutBalloonButtonType?
) {
}
override fun onDraggablePOIItemMoved(p0: MapView?, p1: MapPOIItem?, p2: MapPoint?) {
}
}
그리고 이건 build.gradle설정인데요
plugins {
id ‘com.android.application’
id ‘org.jetbrains.kotlin.android’
id ‘com.google.gms.google-services’
}
android {
namespace ‘com.example.FoodAdventure’
compileSdk 33
defaultConfig {
applicationId "com.example.FoodAdventure"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.android.identity:identity-credential:+'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation files('libs\\libDaumMapAndroid.jar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation "com.kakao.sdk:v2-all:2.14.0" // 전체 모듈 설치, 2.11.0 버전부터 지원
implementation "com.kakao.sdk:v2-user:2.14.0" // 카카오 로그인
implementation "com.kakao.sdk:v2-talk:2.14.0" // 친구, 메시지(카카오톡)
implementation "com.kakao.sdk:v2-story:2.14.0" // 카카오스토리
implementation "com.kakao.sdk:v2-share:2.14.0" // 메시지(카카오톡 공유)
implementation "com.kakao.sdk:v2-navi:2.14.0" // 카카오내비
implementation "com.kakao.sdk:v2-friend:2.14.0" // 카카오톡 소셜 피커, 리소스 번들 파일 포함
implementation fileTree(include: ['*.jar'], dir: 'libs')
//implementation 'com.android.volley:volley:1.1.1' //카카오페이 데이터 통신을 위한 http통신 라이브러리
implementation 'com.google.code.gson:gson:2.8.6'//카카오페이 데이터를 json으로 파싱하기위한 라이브러리
implementation platform('com.google.firebase:firebase-bom:32.1.1')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-auth-ktx:22.0.0'
implementation 'com.google.firebase:firebase-auth-ktx:21.0.3'
implementation 'com.google.android.gms:play-services-location:21.0.1'
}
apply plugin: ‘com.google.gms.google-services’
이렇게 되어있습니다.