1
I have an Android app in Kotlin that orders pizza delivery where the company receives the data of the user’s order and I want the user to also receive the data of the order he made, some time ago I try and do not find the solution. Following method should recover order data in order view class:
private fun recuperarDados() {
dialog = SpotsDialog.Builder()
.setContext(this)
.setMessage("Aguarde")
.setCancelable(false)
.build()
dialog!!.show()
val pedidoRef = idEmpresa?.let {
idUsuarioLogado?.let { it1 ->
firebaseRef
?.child("pedidos_usuario")
?.child("itens")
}
}
val pedidoPesquisa = pedidoRef?.child("status")?.equalTo("confirmado")
pedidoPesquisa?.addValueEventListener(object : ValueEventListener {
override fun onDataChange(dataSnapshot: DataSnapshot) {
pedidos.clear()
if (dataSnapshot.value != null) {
for (ds in dataSnapshot.children) {
val pedido = ds.getValue(ItemPedido::class.java)
itemPedidos.add(pedido!!)
}
adapterPedido!!.notifyDataSetChanged()
dialog!!.dismiss()
}
}
override fun onCancelled(databaseError: DatabaseError) {
}
})
}
Good morning! So are two different apps? One for the user and one for the company?
– Ivan Silva
that’s right, there are two
– Faro