问题描述
我必须通过其他平台使用GPS进行Android编程。在我有权访问GPS硬件(我有一个低级别的GPS驱动程序)的其他平台上,我可以使GPS每秒更新5次,甚至更多
现在我使用Samsung Galaxy S2(它是我清楚它的GPS非常强大,并且可以每秒提供几次更新
当前,当我设置GPS提供商以这样的最短距离和最短时间提供更新时:
mlocManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,0,0,mlocListener
);
我每秒获得1次更新(或两次更新之间的最小差距为800ms),这对我的应用程序来说太低了。是否有办法强制GPS硬件报告更多的更新以某种方式?我猜这不是暴露给用户,但仍然有某种方式来访问GPS HW的寄存器吗?
目前,在大多数电话中,您无法以每秒更新一次的速度更新。这是哈rdware gps限制。
通常情况下,大部分手机都在1hz。
这一切都取决于硬件和你正在使用的场景(室内,室外)
但是,您可以使用
<$ p $这使得你的应用程序可以被动地获取数据,这个数据库允许你的应用程序被动地获取数据。地点的速度比它积极获取地点的速度快,节省了电力。
与setInterval(long)不同,这个参数是确切的。您的应用永远不会收到比此值更快的更新。
此方法设置应用可以处理位置更新的最快速率(以毫秒为单位)。您需要设置此速率,因为其他应用程序也会影响发送更新的速率。位置服务通过调用LocationRequest.setInterval()以最快的速度发送更新,任何应用程序都会请求更新。
如果此速率比您的应用可以处理的速度快,则可能会遇到UI闪烁或数据溢出问题。
I got to program Android from other platforms I used with GPS . on the other platfroms I had access to the GPS HW (I had a low level GPS driver) and by that I could get GPS updates 5 times per second and even moreNow I work with Samsung Galaxy S2 (which it is clear to me that its GPS is very strong and can supply several updates per secondCurrently when I set the GPS provider to supply updates in minimum distance and minimum time like this:
mlocManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER, 0, 0, mlocListener
);
I get 1 update per second (or 800ms as smallest gap between two updates) which is too low for my application. Is there a way to force the GPS HW to report more updates somehow ? I guess it is not exposed to the user but is there still some way to access the registers of the GPS HW somehow ?
Currently you can't get updates faster than once per second in most of the phone.This is the hardware gps limit.
Usually in most of the phones,it is at 1hz.
It all depends on hardware and scenario where you are using ( Indoor,Outdoor)
But again, You could check using
LocationRequest setFastestInterval (long millis)
This allows your application to passively acquire locations at a rate faster than it actively acquires locations, saving power.
Unlike setInterval(long), this parameter is exact. Your application will never receive updates faster than this value.
This method sets the fastest rate in milliseconds at which your app can handle location updates. You need to set this rate because other apps also affect the rate at which updates are sent. Location Services sends out updates at the fastest rate that any app requested by calling LocationRequest.setInterval().
If this rate is faster than your app can handle, you may encounter problems with UI flicker or data overflow.
这篇关于从我的Android中的GPS硬件获得最高的GPS更新速率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!