android gps provider,Android Location Providers - GPS or Network Provider?

本文介绍了Android中的三种位置提供者:GPS、网络和被动提供者,以及它们的工作原理和所需权限。更新内容提到,现在Android使用融合定位提供者,它智能管理底层技术,根据需求提供最佳定位服务,降低了功耗并提高了准确性。融合定位提供者提供了获取当前位置的三种方式:LastLocation、使用监听器和使用PendingIntent。这种方式覆盖了各种场景,为应用提供了灵活的定位解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

There are 3 location providers in Android.

They are:

gps –> (GPS, AGPS): Name of the GPS location provider. This

provider determines location using satellites. Depending on

conditions, this provider may take a while to return a location fix.

Requires the permission android.permission.ACCESS_FINE_LOCATION.

network –> (AGPS, CellID, WiFi MACID): Name of the network

location provider. This provider determines location based on

availability of cell tower and WiFi access points. Results are

retrieved by means of a network lookup. Requires either of the

permissions android.permission.ACCESS_COARSE_LOCATION or

android.permission.ACCESS_FINE_LOCATION.

passive –> (CellID, WiFi MACID): A special location provider for

receiving locations without actually initiating a location fix. This

provider can be used to passively receive location updates when other

applications or services request them without actually requesting the

locations yourself. This provider will return locations generated by

other providers. Requires the permission

android.permission.ACCESS_FINE_LOCATION, although if the GPS is not

enabled this provider might only return coarse fixes. This is what

Android calls these location providers, however, the underlying

technologies to make this stuff work is mapped to the specific set of

hardware and telco provided capabilities (network service).

The best way is to use the “network” or “passive” provider first,

and then fallback on “gps”, and depending on the task, switch between

providers. This covers all cases, and provides a lowest common

denominator service (in the worst case) and great service (in the best

case).

2174572ecc538c7784fef27a18c18e61.png

-----------------------Update-----------------------

Now Android have Fused location provider

The Fused Location Provider intelligently manages the underlying location technology and gives you the best location according to your needs. It simplifies ways for apps to get the user’s current location with improved accuracy and lower power usage

Fused location provider provide three ways to fetch location

Last Location: Use when you want to know current location once.

Request Location using Listener: Use when application is on screen / frontend and require continues location.

Request Location using Pending Intent: Use when application in background and require continues location.

References :

--------------------------------------------------------

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值