So I have a collection in Cloud Firestore which I populate by clicking some buttons in my application. Once I close the app, I want the collection to be empty. Is there any way I can do that? I tried to implement onStop() method, but it does nothing.
protected void onStop() {
super.onStop();
db.collection("AddPlaces").document()
.delete()
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d("SUCCES", "DocumentSnapshot successfully deleted!");
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w("FAILURE", "Error deleting document", e);
}
});
}
Any ideas if I can achieve that?