谷歌Android地图LocationClient [英] Android Google Maps LocationClient
问题描述
我是用我的Android应用程序的谷歌地图Android的API V2 LocationClient: 的http://developer.android.com/reference/com/google/android/gms/location/LocationClient.html
I am using the Google Maps Android API v2 LocationClient in my Android application: http://developer.android.com/reference/com/google/android/gms/location/LocationClient.html
我调用connect()和断开()自己。
I am calling connect() and disconnect() myself.
我也注册了一个监听器GooglePlayServicesClient.ConnectionCallbacks: <一href="http://developer.android.com/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html" rel="nofollow">http://developer.android.com/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html
I have also registered a listener for GooglePlayServicesClient.ConnectionCallbacks: http://developer.android.com/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html
我观察回调onConnected()被调用的监听器调用connect()的LocationClient后。
I am observing that the callback onConnected() is called on the listener after calling connect() on the LocationClient.
不过似乎onDisconnected()的调用LocationClient断开连接()后,从来没有号召听众。
However it seems that onDisconnected() is never called on the listener after calling disconnect() on the LocationClient.
这是正常的行为呢?
推荐答案
我想这是一个有点晚了,但我想知道是相同的,所以我会回答。
I guess it's a bit late but I was wondering the same, so I'll reply.
这是正常的行为。这不是从API文档清晰,但在 HTTP官方教程://开发商.android.com /培训/位置/检索-current.html ,它说,大约onDisconnected:
It's normal behaviour. It's not clear from the API documentation, but in the official tutorial at http://developer.android.com/training/location/retrieve-current.html, it says about onDisconnected:
由定位服务调用,如果连接到客户机的位置 降低由于错误的。
Called by Location Services if the connection to the location client drops because of an error.
这意味着,如果你调用断开连接()自己应该不会被调用。
Which means it shouldn't be called if you call disconnect() yourself.
这篇关于谷歌Android地图LocationClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!