user6597752
user6597752

Reputation: 190

How to cancel firebase setValue() intentionaly for android

I have read this question it was asked for swift but I have an exact same question for android, which is how to cancel setValue() process when I want programmaticaly ? To make the question more clear if I have a timer for the process when timer completes I want it to cancel any setValue() process .

Upvotes: 0

Views: 656

Answers (1)

Pavneet_Singh
Pavneet_Singh

Reputation: 37404

You can use the same for android as well

purgeOutstandingWrites

The Firebase Database client automatically queues writes and sends them to the server at the earliest opportunity, depending on network connectivity. In some cases (e.g. offline usage) there may be a large number of writes waiting to be sent. Calling this method will purge all outstanding writes so they are abandoned.

All writes will be purged, including transactions and onDisconnect() writes. The writes will be rolled back locally, perhaps triggering events for affected event listeners, and the client will not (re-)send them to the Firebase backend.

Upvotes: 5

Related Questions