gpt4 book ai didi

android - 谁在 Android 的 LocationManager 中触发 onLocationChanged?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:53:23 25 4
gpt4 key购买 nike

我在以前关于 Android 的位置提供程序的帖子中寻找这个答案,但我找不到答案。 onLocationChanged 是如何触发的?自 GPS 守护程序/库在到达 LocationManager 之前固定位置的过程是什么?它是由 Gps 守护进程直接触发还是首先在 Android Java 框架中的某个地方触发?

非常感谢

N

最佳答案

我一直在查看代码,这是我目前所拥有的:

requestLocationUpdates 注册 onLocationChangeListener。这反过来gets stored作为具有 ListenerTransport 值的 HashMap 中的键。

ListenerTransport 有一个 private variable这是有问题的听众。 ListenerTransport 似乎只是一个接收消息的类,calls the onLocationChange method听众的。

这是我迷路的地方:ListenerTransport 扩展 ILocationListener.Stubs,后者扩展了 Binder。因此,它是一种 RPC 调用。但是电话去哪儿了?

我注意到在 requestLocationUpdates()ILocationListener.Proxy 中,调用了 IBinder.transact(Stub.TRANSACTION_requestLocationUpdates,...)。有待观察这会发生什么......

关于android - 谁在 Android 的 LocationManager 中触发 onLocationChanged?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7261935/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com