Android Google Maps LocationClient

Android Google Maps LocationClient,第1张

概述我在Android应用程序中使用GoogleMapsAndroidAPIv2LocationClient:http://developer.android.comeference/com/google/android/gms/location/LocationClient.html我自己打电话给connect()和断开连接().我还为GooglePlayServicesClient.ConnectionCallbacks注册了一个侦听

我在Android应用程序中使用Google Maps AndroID API v2 LocationClIEnt:
http://developer.android.com/reference/com/google/android/gms/location/LocationClient.html

我自己打电话给connect()和断开连接().

我还为GooglePlayServicesClIEnt.ConnectionCallbacks注册了一个侦听器:
http://developer.android.com/reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html

我观察到在LocationClIEnt上调用connect()之后,在侦听器上调用了回调onConnected().

但是,似乎在LocationClIEnt上调用disconnect()之后,从未在侦听器上调用过ondisconnected().

这是正常行为吗?

解决方法:

我想有点晚了,但我也想知道,所以我会回复.

这是正常的行为. api文档尚不清楚,但是在官方教程http://developer.android.com/training/location/retrieve-current.html中,它说明了ondisconnected:

Called by Location Services if the connection to the location clIEnt
drops because of an error.

这意味着如果您自己调用disconnect(),则不应调用它.

总结

以上是内存溢出为你收集整理的Android Google Maps LocationClient全部内容,希望文章能够帮你解决Android Google Maps LocationClient所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1092997.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存