谁在Android中的LocationManager中触发onLocationChanged?

时间:2011-08-31 18:51:23

标签: android geolocation gps location

我之前关于Android的位置提供商的帖子中找到了这个答案,但我找不到答案。如何触发onLocationChanged以及GPS守护程序/库修复位置直到它到达LocationManager的过程是什么?它是由Gps守护程序直接触发还是首先在Android Java Framework中的某个位置?

非常感谢

<磷>氮

2 个答案:

答案 0 :(得分:4)

我一直在寻找代码,这就是我到目前为止所做的:

requestLocationUpdates注册onLocationChangeListener。 这反过来gets stored作为哈希值中的一个键,其值为ListenerTransport。

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

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

我在ILocationListener.Proxy的{​​{1}}注意到了requestLocationUpdates()。可以看出这种情况发生了什么以及发生了什么......

答案 1 :(得分:1)

点击此处:More about Location in Android

Location Listener in Android

这会对你有所帮助!