LocationClient类不能对谷歌游戏服务找到启22 [英] LocationClient class not found on google play services rev 22

查看:214
本文介绍了LocationClient类不能对谷歌游戏服务找到启22的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了谷歌播放服务,以转速22和 LocationClient 类似乎缺少。这是怎么回事?

I just updated google play services to rev 22 and the LocationClient class appears to be missing. What is going on?

推荐答案

建立在什么@CommnsWare说,这里有步骤迁移到融合的API。

Building on what @CommnsWare said, here are steps to migrate to Fused api.

第一步:获得 GoogleApiClient 的实例,而不是 LocationClient

Step 1: Get an instance of GoogleApiClient instead of LocationClient.

ConnectionCallback (mConnectionCallbacks,mOnConnectionFailedListener下面的示例中)需要稍微修改但应该是微不足道的。

The ConnectionCallback (mConnectionCallbacks, mOnConnectionFailedListener in example below) needs slight modification but that should be trivial.

googleApiClient = new GoogleApiClient.Builder(this)
        .addApi(LocationServices.API)
        .addConnectionCallbacks(mConnectionCallbacks)
        .addOnConnectionFailedListener(mOnConnectionFailedListener)
        .build();

第2步:更新连接和断开通话

替换 locationClient.connect() googleApiClient.connect() locationClient .disconnect() googleApiClient.disconnect()

第三步:使用LocationServices.FusedLocationApi发送您的请求。  例如,

LocationServices.FusedLocationApi.getLastLocation(googleApiClient)
LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request, mLocationListener);

希望这有助于!

这篇关于LocationClient类不能对谷歌游戏服务找到启22的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆