Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Play services Task API: can a Task be cancelled

When use )" rel="nofollow noreferrer">Tasks.call(Callable), can I cancel it, and remove all the listeners from the task?

like image 420
Wenhui Avatar asked Jan 31 '26 11:01

Wenhui


1 Answers

If you need a way to remove all the listeners from any Task at any time, you will have to remember all the listeners you previously added, then remove them all manually.

If you're working with an Android app, and you add Activity-scoped listeners, they will be removed automatically when the host activity is stopped (goes through its onStop() lifecycle method). Note that you have to pass the activity as an argument to addOnCompleteListener().

like image 183
Doug Stevenson Avatar answered Feb 02 '26 06:02

Doug Stevenson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!