如何使用kotlin在Android中获取firebase中child的键值

How to get the key value of child in firebase in Android using kotlin

我想获取此列表中选择“水管工”工作的 phone 个数字的列表,以及使用 kotlin 在 firebase 中接受或不接受该工作的数字。

.

我认为您正在寻找嵌套 属性 中的 use a query,您可以这样做:

// TODO: set ref to point to the parent node of your results
val query = ref.orderByChild("Plumber/accepted").equalTo(true)

query.addChildEventListener(object : ChildEventListener {
    override fun onChildAdded(snapshot: DataSnapshot, previousChildKey: String?) {
        println(snapshot.key) // "+91111111111"
    }
    ...
})