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

一曲冷凌霜 提交于 2019-12-10 19:16:55

问题


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:


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



来源:https://stackoverflow.com/questions/22408728/how-to-get-current-location-from-google-api-for-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!