[서울시 앱 공모전 / 서울시를 이겨라] Tmap API 지도 띄우기
2017. 12. 12. 04:49ㆍAndroid
Tmap API 지도 띄우기
# 마이 앱 등록 및 App API 키 발급
# 해당 앱 개발 시 필요한 서비스 등록
위에 이미지에 서비스 관리 들어가서 Tmap 서비스 등록하면 되는데,
현재 2017년 12월 1일 이후로 신규 api 키 발행이 중지됐음.
SK telecom 개발자센터에서 신규 Tmap api를 발급받을 수 있지만 유료임.
# 프로젝트에 Tmap SDK 라이브러리 추가
# 권한 추가
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
# map Layout 설정
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.jaehyukshin.welcomeseoulloreview.FacilityMenu.GuideInfoFragment"> <RelativeLayout android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent"> </RelativeLayout> </RelativeLayout> | cs |
# map 설정
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | public class GuideInfoFragment extends Fragment { View view; RelativeLayout mapView; TMapView tMapView; String apiKey = "~ ~ ~"; public GuideInfoFragment(){ } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_guide_info, container, false); //선언 mapView = (RelativeLayout) view.findViewById(R.id.map); tMapView = new TMapView(getActivity()); //세팅 tMapView.setSKPMapApiKey(apiKey); tMapView.setLocationPoint(126.970325,37.556152); tMapView.setCenterPoint(126.970325,37.556152); tMapView.setCompassMode(false); tMapView.setIconVisibility(true); tMapView.setZoomLevel(15); tMapView.setMapType(TMapView.MAPTYPE_STANDARD); //일반지도 tMapView.setLanguage(TMapView.LANGUAGE_KOREAN); tMapView.setTrackingMode(false); tMapView.setSightVisible(false); mapView.addView(tMapView); return view; } } | cs |
'Android' 카테고리의 다른 글
[서울시 앱 공모전 / 서울시를 이겨라] Guide Splash Activity with VideoView (0) | 2017.12.08 |
---|---|
[서울시 앱 공모전 / 서울시를 이겨라] Guide Splash Activity with Viewpager (0) | 2017.12.06 |
[Global SW 공모대전] README 이미지 (0) | 2017.12.04 |
[서울시 앱 공모전 / 서울시를 이겨라] ViewPager with fragments (0) | 2017.11.24 |
[서울시 앱 공모전 / 서울시를 이겨라] 서울 열린데이터 광장 Open API 사용 / AsyncTask / Parsing (0) | 2017.11.22 |