2

我使用融合的位置谷歌API客户端获取位置,因为我有更新设备,所以它工作正常,可能有像客户可能没有更新谷歌播放服务。因此Fused位置(Google API Client)需要哪种最低谷歌播放服务版本,以及如何以编程方式进行检查或验证。如何处理谷歌API客户端,如果没有更新谷歌播放服务

+0

请访问https://stackoverflow.com/a/34943703/4853552“如何检查” –

+0

Fused位置(Google API Client)需要什么最低谷歌播放服务版本。 api.isGooglePlayServicesAvailable(活性); – Siddharth

+0

处理Google API客户端的完整示例,[AbstractGoogleApiClientActivity](https://github.com/commonsguy/cw-omnibus/blob/master/Location/FusedNew/app/src/main/java/com/commonsware/android/ weather2/AbstractGoogleApiClientActivity.java) – Blackkara

回答

2

我不认为任何最低版本在Android文件中提到https://developer.android.com/training/location/retrieve-current.html

但是如果你想同时连接到GoogleApiClient处理错误,你应该实现GoogleApiClient.OnConnectionFailedListener https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApiClient.OnConnectionFailedListener

并称之为码通过传递错误结果代码并实现onActivityResult处理结果:

GooglePlayServicesUtil.showErrorDialogFragment(resultCode,this,CONNECTION_FAILURE_RESOLUTION_REQUEST); 

注:我还没有实现它,但是这是怎么它完成了。