我需要从Google+ API获取Android设备的当前位置。
我已经在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();
我成功获取了所有数据,但是位置为空。
有人知道如何解决这个问题吗?