android - 如何从适用于 Android 的 Google+ API 获取当前位置?

标签 android google-api google-plus

我需要从适用于 Android 的 Google+ API 获取当前位置。

我已在 Google API 控制台中完成所有操作,并将我的应用程序与具有 SHA1 和程序包名称的客户端 ID 相关联。

我成功获取了几乎关于用户名、个人资料图片、封面图片、电子邮件...的数据

但我对位置有疑问。我无法获取用户位置。

我使用这个范围:

mGoogleApiClient = new GoogleApiClient.Builder(this)
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this).addApi(Plus.API, null)
    .addScope(Plus.SCOPE_PLUS_PROFILE).build();

我使用此代码获取个人资料信息:

 String personName = currentPerson.getDisplayName();
            String userId = currentPerson.getId();
            String personPhotoUrl = currentPerson.getImage().getUrl();
            String personGooglePlusProfile = currentPerson.getUrl();
            String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
            String location = currentPerson.getCurrentLocation();
            String coverPhoto = currentPerson.getCover().getCoverPhoto().getUrl();

我成功获取了所有这些数据,但我得到的位置为空。

有谁知道如何解决这个问题?

最佳答案

看起来 currentLocation 值不是 currently available through the API .

关于android - 如何从适用于 Android 的 Google+ API 获取当前位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22408728/

相关文章:

android - 如何使用 Android 色板

google-maps - Google Places API 给出一个拼写正确的结果和所有拼写错误的结果

java - 如何退出 Google+ 帐户?

java - 为什么使用 SQLite 的 Constants 接口(interface)来保存字段名称?

android - 无法分配内存 : 8 (NetBeans)

java - 错误 : Failed to resolve: com. google.android.gms :play-services-maps:16. 1.0 不断出现

javascript - 如何更改 Google 登录按钮的语言

android - 如何判断 Play Integrity 判决中的证书 SHA-256 摘要是否有效?

javascript - GoogleUser 对象没有 grantOfflineAccess 方法?

java - 无法解析 com.google.android.gms.plus.Plus 类