본문

171129(수) - Location and Maps

Location and Maps


android.location

- Google Location Services API는 Google Play services의 한 부분이다.

- location provider choice나 power management와 같은 tasks를 더 automate하여 more powerful하게 해주는 high-level framework 

- location service는 activity detection과 같이 framework API에서는 available 한 new features도 제공한다.

- framework API 뿐만 아니라 adding location awareness 하려는 developers도 해당 Location Services API 사용을 적극적으로 consider 해야 한다.

Google Location Services for Android.



Location Services

- location framework에서 central component는 underlying device의 location and bearing을 결정하는 API를 제공하는 LocationManager  system service 이다.

- 다른 system services와 마찬가지로 LocationManager를 instantiate 하지는 않는다. Rather, request instance from system by calling getSystemService(Context.LOCATION_SERVICE). 이 method는 returns a handle to a new LocationManager instance.


- Application에 LocationManager가 있으면, 아래  three things가 가능하다.

1. last known user location을 determine하기 위해서 Query for the list of all instances LocationProvider

Android 8.0 (API level 26) and higher, app이 runinng in the background일 때, current location을 request하면 device는 only a few times each hour calculates the location


calculation limits에 대해서는 Background Location Limits 참조

2. from a location provider, user의 current location을 periodic updates 하기 위해서 register/unregister 한다.

3. device가 proximity (specified by radius in meters) of a given lat/long에 진입하면 Intent가 fired 되기 위해서 register/unregister 한다.


more information about  Location Strategies guide.



Google Maps Android API

- can add maps to app based on Google Maps data, with the Google Maps Android API

- API는 automatically handles Google Maps servers, data downloading, map display, 

- API를 call하여 add markers, polygons and overlays, and user's view change 가능하다.

- key class는 MapView

- MapView는 Google Maps service로 부터 얻은 data를 displays

- MapView가 focus이면, touch gestures와 zoom을 맵에서 자동적으로 network requests handling for additional maps tiles

- users가 map을 control 할 수 있는 모든 UI elements를 제공

- app은 MapView methods를 사용하여 programmatically control and draw number of overlays on top of the map.

- Google Maps Android API는 Android platform에 included 되어 있지는 않지만, Android 2.2 이상이면 Google play service를 통해 Google Play Store를 실행하여 동작 가능


- Google Maps를 app에 intergrate 하고 싶다면, Android SDK를 위한 Google Play services libraries를 설치해야 한다.






공유

댓글