Google+ API : Get Profile's currentLocation

孤者浪人 提交于 2019-12-02 16:59:15
user3175273

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.

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.

nicofx

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.

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