Android的Firebase身份验证 - 获取用户的照片 [英] Android Firebase Auth - Get User's Photo

查看:131
本文介绍了Android的Firebase身份验证 - 获取用户的照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从移动应用程序中使用体面的分辨率检索用户照片?我查看了指南和API文档,推荐的方法似乎是使用 FirebaseUser#getPhotoUrl()。然而,这给了一个网址分辨率50x50像素,这是太低了,有用的照片。有没有办法让客户要求更高分辨率的用户照片?我已经单独测试了Facebook登录和Google登录的sdks,在这两种情况下,照片的分辨率都高于Firebase Auth所提供的分辨率。为什么Firebase身份验证更改原始解决方案,我怎么能强制它不这样做?感谢。

解决方案

内部onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth)

尝试如果您使用Facebook登录:


$ b

  if(!user.getProviderData()。isEmpty()&& user.getProviderData ().size()> 1)
String URL =https://graph.facebook.com/+ user.getProviderData()。get(1).getUid()+/ picture?type =大;


How can I retrieve a photo of the user with decent resolution that can be used from a mobile app? I looked at the guides and the api docs and the recommended way seemed to be to use FirebaseUser#getPhotoUrl(). This however gives back a url to a photo with resolution 50x50 px, which is too low to be useful. Is there a way for the client to request a higher res photo of the user? I've tested the sdks of Facebook Login and Google Sign-in separately, and in both cases the resolutions of the photos are higher than what Firebase Auth gives back. Why does Firebase Auth change the original resolutions and how can I force it not to do that? Thanks.

解决方案

Inside onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth)

Try If you login with Facebook:

 if (!user.getProviderData().isEmpty() && user.getProviderData().size() > 1)
                String URL = "https://graph.facebook.com/" + user.getProviderData().get(1).getUid() + "/picture?type=large";

这篇关于Android的Firebase身份验证 - 获取用户的照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆