-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Put unregister volume receiver in try-catch block #54
Conversation
Thanks for your PR. And some people have meet this problem, while I cannot reproduce it by example. When I press back, |
That would be great! |
… from onHostDestroy
Done. I also removed the |
Thanks for your work. I'll test it later.
|
I created a repo with a description of the algorithm for reproducing the error. Try it, maybe you can reproduce this way. |
I'm glad to help! Yes, strange things happen...:) |
Hello!
It's a fix for issue #49 .
When back button is pressed, onHostDestroy method is called.
Inside the method we can see line
mContext.unregisterReceiver(volumeBR);
and it's ok, but if we want to launch an app again and try to call setVolume method, we get an IllegalArgumentException, because the first line of setVolume method is
mContext.unregisterReceiver(volumeBR);
and it's an attempt to unregister an already unregistered instance of the receiver.
I put the line in the try-catch block to fix the issue.