Location- and maps-based applications and services are compelling for mobile device users. You can build these capabilities into your applications using the classes of the android.location package and the Google Maps external library. The sections below provide details.
로케이션location기반 또는 맵map기반 애플리케이션과 서비스들은 모바일 디바이스 사용자에게 매우 중요한 영향력을 갖는다. 여러분은 이 기능을 android.location 패키지와 구글 맵 외부 라이브러리를 사용해서 여러분의 애플리케이션에 만들 수 있다. 아래의 섹션은 그것에 대한 상세한 설명을 제공한다.
Android gives your applications access to the location services supported by
the device through the classes in the android.location package. The
central component of the location framework is the
LocationManager system service, which provides an API to
determine location and bearing if the underlying device (if it supports location
capabilities).
안드로이드는 여러분의 애플리케이션이 android.location 패키지내에 있는 클래스를 통해 디바이스에 의해 지원되는 로케이션 서비스에 접근할 수 있도록 한다. 로케이션location 프레임워크의 중심 컴포넌트는 로케이션 매니저LocationManager 시스템 서비스이다. 그것은 아래에 있는 디바이스가 (만약 로케이션 기능을 지원한다면) 위치와 방향각을 결정하기 위한 API를 제공한다.
As with other system services, you do not instantiate a LocationManager directly.
Rather, you request an LocationManager instance from the system by calling
getSystemService(Context.LOCATION_SERVICE).
The method returns a handle to a new LocationManager instance.
다른 시스템 서비스들과 같이, 여러분은 로케이션 매니저LocationManager를 직접적으로 인스턴스화해서는 안된다. 대신, getSystemService(Context.LOCATION_SERVICE)를 호출함으로써 시스템으로부터 로케이션 매니저LocationManager 인스턴스를 요청해야 한다.
Once your application has a handle to a LocationManager instance, your application will be able to do three things:
일단 여러분의 애플리케이션이 로케이션 매니저LocationManager에 대한 핸들(handle)을 가진다면, 여러분의 애플리케이션은 다음의 세 가지를 할 수 있다.
However, during initial development in the emulator, you may not have access to real data from a real location provider (Network or GPS). In that case, it may be necessary to spoof some data for your application using a mock location provider.
하지만 처음에 에뮬레이터에서 개발하는 동안 여러분은 실제 로케이션 프로바이더(네트워크 또는 GPS)로부터의 실제 데이터에 접근할 수 없을 수도 있다. 그런 경우에, 여러분은 모의mock 로케이션 프로바이더를 사용함으로써, 애플리케이션을 위한 약간의 데이터를 속이는 것이spoof 필요할 수도 있다.
Note: If you've used mock LocationProviders in previous versions of the SDK, you can no longer provide canned LocationProviders in the /system/etc/location directory. These directories will be wiped during boot-up. Please follow the new procedures outlined below.
Note: 만약 여러분이 SDK의 이전 버전에 있는 모의mock 로케이션 프로바이더LocationProviders를 사용했다면, 여러분은 /system/etc/location 디렉토리에 있는 미리 준비된 로케이션 프로바이더LocationProviders를 더 이상 제공받지 못할 것이다. 이 디렉토리은 부팅을 하면서 없어질 것이다. 아래 요약된 새로운 절차를 따라하길 바란다.
When testing your application on the Android emulator, there are a couple different ways to send it some mock location data: you can use the DDMS tool or the "geo" command option in the emulator console.
안드로이드 에뮬레이터에서 여러분의 애플리케이션을 테스트할 때, 모의 로케이션 데이터를 보내기 위한 두가지 서로 다른 방법이 있다. 여러분은 DDMS 도구를 사용하거나, 또는 에뮬레이터 콘솔에서 “geo” 명령 옵션을 사용할 수 있다.
With the DDMS tool, you can simulate location data a few different ways:
DDMS 툴tool을 사용해서, 여러분은 몇 가지 서로 다른 방법으로 로케이션 데이터를 시뮬레이션 할 수 있다.
For more information on using DDMS to spoof location data, see the Using DDMS guide.
위치 데이터를 속이기 위해 DDMS를 사용하는 것에 대한 더 많은 정보에 대해서는 아래의 URL을 참조하라. http://developer.android.com/guide/developing/tools/ddms.html#emulator-control
Launch your application in the Android emulator and open a terminal/console in
your SDK's /tools directory. Connect to the emulator console. Now you can use:
안드로이드 에뮬레이터 안에 있는 여러분의 애플리케이션을 시작시키고, SDK의 /tools 디렉토리에서 터미널/콘솔(역주: adb shell)을 열어라. 그리고 에뮬레이터 콘솔에 연결시켜라. 이제 여러분은 다음과 같은 것을 사용할 수 있다.
geo fix to send a fixed geo-location.
This command accepts a longitude and latitude in decimal degrees, and an optional altitude in meters. For example:
geo fix -121.45356 46.51119 4392
geo nmea to send an NMEA 0183 sentence.
This command accepts a single NMEA sentence of type '$GPGGA' (fix data) or '$GPRMC' (transit data). For example:
geo nmea $GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62
이 커맨드는 십진수 각도인 경도longitude와 위도latitude, 그리고 선택 사항으로 미터로 된 고도altitude를 받아들인다. 예를 들어 다음과 같다.
geo fix -121.45356 46.51119 4392
이 커맨드는 ‘$GPGGA’(고정 데이터) 타입 또는 ‘$GPRMC’(추이(transit, 변화) 데이터) 타입의 하나의 NEMA 구문을 받아들인다. 예를 들어 다음과 같다.
geo nmea $GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62
For information about how to connect to the emulator console, see Using the Emulator Console.
에뮬레이터 콘솔에 접속하는 방법에 대한 정보에 대해서는 아래의 URL을 참조하라.http://developer.android.com/guide/developing/tools/emulator.html#console
To make it easier for you to add powerful mapping capabilities to your application, Google provides a Maps external library that includes the com.google.android.maps package. The classes of the com.google.android.maps package offer built-in downloading, rendering, and caching of Maps tiles, as well as a variety of display options and controls.
여러분의 애플리케이션에 강력한 맵 기능을 추가하는 것을 더 쉽게 하기 위해서, 구글은 com.google.android.maps 패키지를 포함하고 있는 맵 외부 라이브러리를 제공한다. com.google.android.maps 패키지의 클래스들은 다양한 디스플레이 옵션과 컨트롤들과 함께 내장되어 있는built-in 다운로딩, 렌더링, 그리고 맵 타일들tiles의 캐슁caching을 제공한다.
The key class in the Maps package is
com.google.android.maps.MapView, a subclass of
ViewGroup. A MapView displays a map with data obtained
from the Google Maps service. When the MapView has focus, it will capture
keypresses and touch gestures to pan and zoom the map automatically, including
handling network requests for additional maps tiles. It also provides all of the
UI elements necessary for users to control the map. Your application can also
use MapView class methods to control the MapView programmatically and draw a
number of Overlay types on top of the map.
맵 패키지에서 핵심 클래스는 뷰그룹의 서브클래스인 com.google.android.maps.MapView이다. 맵뷰는 구글 맵 서비스로부터 가져온 데이터를 사용해서 맵을 보여준다. 맵뷰MapView가 포커스를 가지면, 그것은 추가적인 맵 타일들에 한 네트워크 요청을 처리하는 것을 포함하여하, 맵을 자동으로 움직이고 확대 축소하기 위해 키입력과 터치 제스쳐들을 캡쳐할 것이다. 그것은 또한 맵을 제어하기 위해 사용자에게 필요한 모든 UI 엘리먼트를 제공한다. 여러분의 애플리케이션은 또한 맵뷰MapView를 프로그램적으로 제어해서 그 맵상에 다수의 오버레이overlay 타입들을 그리기 위해 맵뷰MapView 클래스 메쏘드를 사용할 수 있다.
In general, the MapView class provides a wrapper around the Google Maps API that lets your application manipulate Google Maps data through class methods, and it lets you work with Maps data as you would other types of Views.
일반적으로, 맵뷰MapView 클래스는 여러분의 애플리케이션으로 하여금 클래스 메쏘드를 통해 구글 맵 데이터를 조작할 수 있게 하는 구글 맵 API를 감싸는 래퍼wrapper를 제공하며, 그것은 여러분으로 하여금 다른 타입의 뷰처럼 맵 데이터를 가지고 작업할 수 있게 한다.
The Maps external library is not part of the standard Android library, so it may not be present on some compliant Android-powered devices. Similarly, the Maps external library is not included in the standard Android library provided in the SDK. So that you can develop using the classes of the com.google.android.maps package, the Maps external library is made available to you as part of the Google APIs add-on for the Android SDK.
맵 외부 라이브러리는 표준 안드로이드 라이브러리의 부분이 아니다. 그러므로 그것은 어떤 안드로이드 호환 디바이스에서는 존재하지 않을 수 있다. 유사하게, 맵 외부 라이브러리는 SDK에 제공되는 표준 안드로이드 라이브러리에 포함되지 않는다. 여러분이 com.google.android.maps 패키지의 클래스를 사용해서 개발하기 위해서는, 안드로이드 SDK에 대한 구글 API의 추가 항목의 일부인 맵 외부 라이브러리를 여러분이 사용할 수 있어야 한다.
To learn more about the Maps external library and how to download and use the Google APIs add-on, visit
맵 외부 라이브러리와 구글 API 추가분add-on을 다운로드하고 사용하는 방법에 대해서 더 많이 배우기 위해서는 아래의 URL을 방문하라.
http://code.google.com/android/add-ons/google-apis
http://code.google.com/android/add-ons/google-apis
For your convenience, the Google APIs add-on is also included in the Android SDK.
여러분의 편의를 위해, 구글 API 추가분add-on 또한 안드로이드 SDK안에 포함되어 있다.
Note: In order to display Google Maps data in a MapView, you must register with the Google Maps service and obtain a Maps API Key. For information about how to get a Maps API Key, see Obtaining a Maps API Key.
Note: 맵뷰MapView에서 구글 맵 데이터를 보여주기 위해, 여러분은 구글 맵 서비스에 등록해야 하며, 맵 API 키key를 얻어야 한다. 맵 API 키를 얻는 방법에 대한 정보에 대해서는 Obtaining a Maps API Key(http://code.google.com/android/add-ons/google-apis/mapkey.html)를 보라.