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

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

问题描述

有没有办法调试Firebase数据库连接(Android)?我使用了一个非常简单的例子(没有什么大的,只有两个监听器来监听变化),它检查 /。info / connected 的值。大多数情况下,它返回false,数据不同步。有时它可以工作,但不可靠。



互联网连接似乎没有问题 - 身份验证和存储在手机上工作,同一网络中的另一个手机可以连接到数据库就好了,所以我认为它必须做一些与手机。我正在测试一个三星XCover 3(棒棒糖,作品)和一个Wiko日落2(奇巧,不起作用)。

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



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

解决方案

正如@qbix所说的,你可以使用
$ b $ pre $ FirebaseDatabase.getInstance()。setLogLevel(Logger.Level.INFO)

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

  package com.google.firebase.database; 

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

private Level(){
}
}
}

更多信息: MakinGIANTS - Post


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.

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).

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

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.

解决方案

As @qbix said you can use

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

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() {
    }
  }
}

More info at: MakinGIANTS - Post

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

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