无法获取GPlus配置文件图片。 Google Plus图片提取网址是否已更新?

时间:2014-03-13 04:38:32

标签: android google-plus

这很奇怪,但直到昨天我才能在我的应用中获得gplus用户的图像,但今天它还没有到来。没有什么是空白的。只是在某个时候出现..

我一直在使用Getting Google+ profile picture url with user_id中指定的网址,但这些网址似乎都无效,并提供 404错误

https://plus.google.com/s2/photos/profile/116018066779980863044?sz=100

如果有人能帮助我解释为什么这种奇怪的行为。配置文件图片很少出现。但大多数情况下它都是空白的。

2 个答案:

答案 0 :(得分:1)

您使用的图片网址从不是公共API,因此无法保证它会继续有效。建议的做法是使用people.get API方法获取profile => image =>而是url值。如果用户更改其头像,该URL可能会停止工作,因此您可能希望获取实际图像并将其缓存在您自己的服务器上。

答案 1 :(得分:0)

我认为图片网址已更新。

为了得到它,我们可以使用PlusClient对象方法:

imageURL = mPlusClient.getCurrentPerson().getImage().getUrl()
{Returns a String - Image Url as String}

imageURL = mPlusClient.getCurrentPerson().getImage()
{Returns an instance of Image object}