How to get current location from Google+ API for A

2019-07-04 21:33发布

I need to get current location from Google+ API for Android.

I have done everything in Google API Console, and linked my app with client ID with SHA1 and package name.

I successfully get almost data about user name, profile picture, cover picture, email...

But I have problem with location. I can't get user location.

I use this scope:

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

I use this code to get profile information:

 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();

And I sucessfully get all this data, but I get null as location.

Does anyone know how to solve this problem?

1条回答
何必那么认真
2楼-- · 2019-07-04 22:05

It looks like currentLocation values are not currently available through the API.

查看更多
登录 后发表回答