Android: questions about ringerMode listener behavior
harriha opened this issue · 1 comments
Hi,
It seems that the following are happening right now with the ringer mode listener:
- Ringer mode listener reacts to both ringer mode changes and volume changes
- Volume listener is unregistered/registered on
onHostPause/onHostResume
but the ringer listener is not
Just to confirm: are these by design or perhaps considered as bugs?
I personally consider these as somewhat nice features right now, as when I want to react to changes in either volume or ringer mode having just one event listener is enough (although it doesn't pass me e.g. the volume info as volume listener does). Also, when opening the device's full sound settings while my app is active, the ringer mode listener not being unregistered on onHostPause
seems to keep events flowing to my app while adjusting the volumes, although I think one cannot really rely on this behavior, I'd assume this to work by luck only right after the app has been moved to the background.
If these are by design and something you want to keep in the library, might be worth mentioning about these in the docs. I can volunteer to tune the docs if need be.
Related to the previous issue I reported (#24), the behavior regarding removeRingerListener()
is also a bit surprising, as that doesn't only remove the added event listener but also calls unregisterObserver()
, which (as far as I understand correctly), kills the whole functionality and not just that one listener. If this behavior is something to keep, perhaps this would justify also a special mention in the docs.
Hi @harriha, sorry for the late response on this issue.
I'll have a look at your reports soon. Regarding the ringerMode listener: I am not the original author of the ringerMode listener and incorporated/ported it to this library because I was looking to provide a full volume-related solution in one package. I'll try to free up some time to dig into this.