-1

How do I disconnect an activity from Firebase? I made an application where it took information from Firebase database. But it stays connected even after destroying application.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Vasim
  • 9
  • 2
  • 1
    You must explain better your scenario. Maybe giving us some example code taken from your application. Are you authenticating the user using the Auth API (directly or using FirebaseUI), have you set your database RULE to accept all request (even the unauthenticated ones)? What do you mean exactly with 'connected' (logged on?)? – shadowsheep Feb 27 '18 at 10:08
  • 2
    Possible duplicate of [Should I actually remove the valueEventListener?](https://stackoverflow.com/questions/48861350/should-i-actually-remove-the-valueeventlistener) – Alex Mamo Feb 27 '18 at 14:28
  • This depends on **how** you get the information from Firebase. Please share the code of how you read. In general, sharing the [minimal complete code that reproduces the situation you're asking about](http://stackoverflow.com/help/mcve) is the best way to ensure we can help you. – Frank van Puffelen Feb 27 '18 at 15:17

1 Answers1

1

if you mean listening, end is:

real time database

removeEventListener()

firebase firestore

ListenerRegistration registration = query.addSnapshotListener(
    new EventListener<QuerySnapshot>() {
        // ...
    });
//... Stop listening to changes
registration.remove();

but your question is very general...

PeterOne
  • 124
  • 1
  • 4
  • inOnstart method ,I use below code : @Override protected void populateViewHolder(BlogViewHolder viewHolder, Blog model, int position) { viewHolder.setTitle(model.getTitle()); viewHolder.setDesc(model.getDesc()); – Vasim Mar 03 '18 at 06:45