Remove all listeners in Firebase java

android, firebase, firebase-realtime-database, java, listener

Solution

This still applies until now, as you cannot remove all listeners at once.

To check for any updates you can see this link: https://firebase.google.com/support/release-notes/android

Currently, you can do it inside `onDestroy()`

protected void onDestroy(){
super.onDestroy();
yourdatabasereference.removeEventListener(Listenernamehere);
}

Problem

I know that the documentation says "// In Java, each listener must be removed explicitly.". But there is a problem. I deploy my app - add a listener (save pointer). But when I re-deploy my app the listener is still there, but I cannot remove it because I don´t have a pointer for it. So is any way how to remove all listeners? (without server restart)

Original source