I see that the Person object that can be retrieved from the loadPerson method of PlusClient has a getCurrentLocation() method. For some reason I do not see the getCurrentLocation() method in the documentation online. Also, when I try to use it, it returns null always. What's the deal with this function?
Asked
Active
Viewed 572 times
1
-
it's a known bug. see http://stackoverflow.com/questions/13742551/how-to-get-my-location-changed-event-with-google-maps-android-api-v2/14305851#14305851 for how to get current location in android – Rachel Gallen May 25 '13 at 20:06
-
Rachel, not exactly what I was thinking. I dont wan't to get my own location, I want to get someone elses that I have loaded with mPlusClient.loadPeople(). – hellowill89 May 25 '13 at 20:12
2 Answers
1
getCurrentLocation is documented under the Person object:
It returns the users current location if they have set it to a value on their Google+ profile. It will return null if they have not set it to a value.

Lee
- 3,972
- 22
- 17
-
Hey, are you sure? I have a few friends who have locations set as do I but the method always returns `null` I'm guessing it's not actually wired up to anything yet. – Rob Jul 18 '13 at 23:15
-
Have you set your location to be publicly visible? It will only be returned if you have made it public. – Lee Jul 19 '13 at 13:26
-
No, who would? It needs to contain the value for people who have shared their location with the authenticated user. If not, it's pointless. – Rob Jul 19 '13 at 15:27
0
So I hate to be the bearer of bad news on this one, but it seems like Google+ has stopped support for the getCurrentLocation part of their People api. There's a whole thread here about complaints concerning it.
EDIT: Figured out a workaround to the problem. I guess they just put everything in the getplaceslived method.
String location = "";
for(PlacesLived place : Plus.PeopleApi.getCurrentPerson(mGoogleApiClient).getPlacesLived()){
//If the place is primary, record it and break
if(place.isPrimary()){
location = place.getValue();
break;
}
//If it isn't and there isn't any location yet, record the most recent location and wait to see if another is primary
if(location.equals("")){
location = place.getValue();
}
}

HarshMarshmallow
- 1,007
- 11
- 23