mirror of
https://github.com/sudoxnym/audiobookshelf-atv.git
synced 2026-07-16 17:02:26 +00:00
Fix:Unregister android network listener on destroy
This commit is contained in:
parent
62376871e3
commit
94e8978ce6
1 changed files with 8 additions and 0 deletions
|
|
@ -148,6 +148,14 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
|||
|
||||
// detach player
|
||||
override fun onDestroy() {
|
||||
try {
|
||||
val connectivityManager = getSystemService(ConnectivityManager::class.java) as ConnectivityManager
|
||||
connectivityManager.unregisterNetworkCallback(networkCallback)
|
||||
} catch(error:Exception) {
|
||||
Log.e(tag, "Error unregistering network listening callback $error")
|
||||
}
|
||||
|
||||
Log.d(tag, "onDestroy")
|
||||
playerNotificationManager.setPlayer(null)
|
||||
mPlayer.release()
|
||||
castPlayer?.release()
|
||||
|
|
|
|||
Loading…
Reference in a new issue