Good community, I'm starting to work with the new tool that has recently included FireBase, I mean Cloud Firestore. I'm trying to get a list of documents but I get the following error:
com.google.android.gms.tasks.RuntimeExecutionException: com.google.firebase.firestore.FirebaseFirestoreException: FAILED_PRECONDITION: The query requires an index.
In the following line of code:
ArrayList<DocumentSnapshot> documentos= (ArrayList<DocumentSnapshot>) task.getResult().getDocuments();
I hope you can help me with this which is something new, I leave you the full code of the query, greetings.
db.collection("incidencias").whereEqualTo("activa",true).limit(vez*5).orderBy("t_stamp").get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
ArrayList<DocumentSnapshot> documentos= (ArrayList<DocumentSnapshot>) task.getResult().getDocuments();
for(int i=0; i<documentos.size(); i++){
DocumentSnapshot datos=documentos.get(i);
IncidenciaItem incidenciaItem=new IncidenciaItem(datos.getString("titulo"),
datos.getDate("t_stamp"),datos.getString("usuario"),datos.getString("descripcion"),
datos.getString("img1"),datos.getString("img2"),datos.getString("img3"),
datos.getString("direccion"),datos.getGeoPoint("coordenadas"),String.valueOf(datos.getId()),
datos.getBoolean("activa"));
lista.add(incidenciaItem);
}
notificarCambio();
}
});