Google+ API : Get Profile's currentLocation

前端 未结 3 384
青春惊慌失措
青春惊慌失措 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:15

    What I think is that r.placesLived would only give his location but the location of the user nor the location of the exact machine. It could be remembered that you need to have the address. However, it needs to look for another token for verifying a user's exact location. Going into it might only need more of a tracker and not only a location.

    0 讨论(0)
  • 2021-01-31 08:25

    Access to location data is restricted to users who have granted you access to their location data at the time that the OAuth token was generated.

    You have to specifically request access to location data in the scope parameter.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题