Reputation: 43
I implemented a PhoneStateListener how stops audio if you are called and starts it again after you finished. When i exit my app by finish() the PhoneStateListener seems to be still active. After finishing a call the music starts to play. Even if I set the listener=null in onDestroy() it keeps working...
Upvotes: 1
Views: 1323
Reputation: 1006869
Quoting the documentation for listen()
on TelephonyManager
:
To unregister a listener, pass the listener object and set the events argument to LISTEN_NONE (0).
You must do this before your activity goes out of scope, such as in onPause()
or onDestroy()
.
Upvotes: 4