【android】Location-based Service

Geocoding is a concept used to convert an address(or location) to a latitude/longitude pair.

It's provided in android.locatin.Geocoder with the following methods.

  1. getFromLocation
  2. getFromLocationName
  3. getFromLocationName*
The way to get location manager service is as below.
LocationManager locMgr = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
The LocationManager service is a system-level service. System-level services are services that you obtain from the context using the service name; you don't instantiate them directly, and it also provides geographical location details by using three types of location providers:
  1. GPS providers           LocationManager.GPS_PROVIDER
  2. Network providers    LocationManager.NETWORK_PROVIDER
  3. passive provider       LocationManager.PASSIVE_PROVIDER
Permissions:
  1. android.permission.ACCESS_FINE_LOCATION
  2. android.permission.ACCESS_COARSE_LOCATION
Use the flowing source to invoke location settings screen.
startActivityForResult(new Intent(android.provider.Settings.ACTION_LOCATIN_SOURCE_SETTINGS), 0) 
GPX: GPS Exchange Format
KML: Keyhole Markup Language

Use MyLocationOverLay to show where you are now.
<Receiver android:name=".ProximityReceiver">
    <intent-filter>
        <action android:name="com.androidbook.android.intent.PROXIMITY_ALERT" />
       <data android:scheme="geo" />
    </intent-filter>
</Receiver>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值