Add missed callback unregister in NetworkConnectivityChecker

Avoid ConnectivityManager$TooManyRequestsException

Change-Id: Ie2a80576940fd9f91d475a2d1b4626d6d4cfd02d
This commit is contained in:
SpiritCroc 2022-08-09 16:52:57 +02:00
parent 884568cbeb
commit 5726c769ec
1 changed files with 3 additions and 0 deletions

View File

@ -88,6 +88,9 @@ internal class DefaultNetworkConnectivityChecker @Inject constructor(
listeners.remove(listener) listeners.remove(listener)
if (listeners.isEmpty()) { if (listeners.isEmpty()) {
backgroundDetectionObserver.unregister(backgroundDetectionObserverListener) backgroundDetectionObserver.unregister(backgroundDetectionObserverListener)
if (!backgroundDetectionObserver.isInBackground) {
unbind()
}
} }
} }