限制后台数据时,Firebase身份验证不起作用 [英] Firebase authentication is not working while the background data is restricted

查看:39
本文介绍了限制后台数据时,Firebase身份验证不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在基于Firebase Firestore的Android应用程序上工作.我正在使用firebase auth 15.0.0进行登录.但是,如果后台数据受到限制,则登录将不起作用.它返回发生了网络错误(例如超时中断连接或主机不可达).它特别发生在SAMSUNG手机上.请帮助我!我也希望它在后台数据受到限制后也能正常工作.

Currently I am working on an android app which is based on firebase firestore. I am using firebase auth 15.0.0 for login. But login doesn't work if background data is restricted. It returns " a network error (such as timeout interrupted connection or unreachable host) has occurred". It specially happens on SAMSUNG phones. help me please! I want it to work after background data is restricted also.

推荐答案

背景数据现在非常严格.某些手机​​可以在APP的设置中进行设置,例如我的小米.但这是非常手动的操作,并不是真正的解决方案.

Background data is now very restrictive. Some phone can set it in the APP's settings, like my Xiaomi. But that is very manual and can't be a real solution.

正确的方法是使用Firebase Cloud Messaging,它保持所谓的弱套接字连接.这样可以节省电池.

Proper way is to use Firebase Cloud Messaging, which keeps a so-called weak-socket-connection. This way saves battery.

云消息传递可以包含消息<2k,如果您的消息超出该限制,则可以创建通知以通知用户唤醒您的应用程序,并使用前台数据.

The cloud messaging can contain message < 2k, if your message is above that limit, you can create a notification to notify user to wake up your application, and use fore-ground data.

这篇关于限制后台数据时,Firebase身份验证不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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