连接到Google Play服务时出现异常null

时间:2016-03-28 20:16:23

标签: android android-studio google-api google-fit google-fit-sdk

我正在尝试使用https://github.com/googlesamples/android-fit与android studio实现google fit API,但我收到以下错误:

 exception while connecting to google play services null

我已经在google开发者控制台中设置了OAUTH,方法是为我的版本提供软件包名称和SSH。我也启用了API。

我似乎无法弄清楚我还需要做些什么来成功连接Google Play ...

1 个答案:

答案 0 :(得分:0)

我没有使用Android-fit,但在我的项目中使用了Google play Location服务。因此,首先要检查是否存在播放服务。如果方法返回true,则连接到服务。然后在on-connection建立的回调方法中实现您的逻辑。如果它们不存在,则重定向用户从playstore中获取它们。假设设备没有google play store,那么将它们重定向到Web Url进行下载。