简体   繁体   中英

How to get current location from Google+ API for Android?

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?

看起来currentLocation当前不能通过API获得

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM