我需要从适用于 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/