的完整URL我使用谷歌登錄在Android應用並保存在數據庫一個鏈接到他們的資料圖片URL。獲取用戶的谷歌頭像
在過去,我會得到完整的URL,開始與這一個的這些,例如:
https://lh3.googleusercontent.com/{random stuff}/photo.jpg
https://lh4.googleusercontent.com/{random stuff}/photo.jpg
https://lh5.googleusercontent.com/{random stuff}/photo.jpg
https://lh6.googleusercontent.com/{random stuff}/photo.jpg
自從谷歌播放更新這(我認爲在8.3〜)我只得到
/{random stuff}/photo.jpg
這顯然不會鏈接到圖片。
這裏是我的代碼:
GoogleSignInAccount acct = result.getSignInAccount();
if (acct != null)
{
String profilePicPath = "";
if (acct.getPhotoUrl() != null) {
profilePicPath = acct.getPhotoUrl().getPath();
}
}
我在做什麼錯?
編輯:我相信我在做錯的是我在URL後加了getPath()
。
是的,刪除getPath()會給你完整的url。 –