调试 Firebase 数据库 [英] Debugging Firebase Database

查看:38
本文介绍了调试 Firebase 数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法调试 firebase 数据库连接 (Android)?我正在使用一个非常简单的示例(没什么大不了的,只有两个侦听更改的侦听器)来检查 /.info/connected 的值.大多数情况下,它返回 false 并且数据不同步.有时它有效,但不可靠.

Is there a way to debug a firebase database connection (Android)? I'm using a really simple example (nothing big, just two listeners that listen on changes) that checks the value of /.info/connected. Most of the time, it returns false and the data is not synchronized. Sometimes it works, but not reliable.

互联网连接似乎没有问题 - 身份验证和存储在手机上工作,同一网络中的不同手机可以很好地连接到数据库,所以我认为它必须对手机做一些事情.我正在使用 Samsung XCover 3(Lollipop,有效)和 Wiko Sunset 2(Kitkat,无效)进行测试.

There seems to be no problem with the internet connection - Auth and Storage works on the phone and a different phone in the same network can connect to the database just fine, so I think it has to do something with the phone. I'm testing with a Samsung XCover 3 (Lollipop, works) and a Wiko Sunset 2 (Kitkat, doesn't work).

Wiko 手机真的很便宜,这可能是一个原因吗?

The Wiko phone is really cheap, could that be a reason?

是否有任何功能可以更深入地了解 firebase 可以指出问题?我的 ValueEventListener 的 onCancelled 方法没有被调用,也没有日志消息.

Are there any features to look deeper into firebase that could point me to the problem? The onCancelled method of my ValueEventListener doesn't get called and there are no log messages.

推荐答案

正如@qbix 所说的你可以使用

As @qbix said you can use

FirebaseDatabase.getInstance().setLogLevel(Logger.Level.INFO)

有多个级别的日志,来自 firebase src:

There are multiple levels logs, from firebase src:

package com.google.firebase.database;

public interface Logger {
  public static enum Level {
    DEBUG,
    INFO,
    WARN,
    ERROR,
    NONE;

    private Level() {
    }
  }
}

更多信息:MakinGIANTS - 发布

这篇关于调试 Firebase 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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