Google+ API : Get Profile's currentLocation

前端 未结 3 389
青春惊慌失措
青春惊慌失措 2021-01-31 07:36

I\'m currently building a test and trying to get a google+ user location. I\'m testing on myself and have set my position to public.

I was originally planning to use Goo

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 08:32

    This is an old one but still valid question. Even field "currentLocation" is listed as valid reponse People object field, there´s no way to access field´s data.

    Was reported as issue in G+ repository but there is no answer so far.

    If you are still trying to get user´s current location try the following snippet, not sure if this is the best option but it works :):

    Note: "r" holds the client.request() response data (API call)

    r.placesLived.forEach(function(l) {
       if (l.primary) 
        console.log(l.value);
    });
    

    Hope this helps. Cheers.

提交回复
热议问题