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
Crash in constructor MediaSessionCompat (Android) #292
Comments
It's hard to say what the problem is without more context to be able to reproduce the problem. |
The problem is that I'm not sure about the correctness of my decision. |
I know nothing of the specifics of how you're getting the error, so I cannot comment on the decision you made. Context is critical. |
Is the reason for getting an exception is AplicationContext? |
If you do not provide your app code in which you are "creating an object of MediaSessionCompat" I cannot help you. Send me a sample project reproducing the issue you are running into and I can try to help. |
https://github.com/ragnarek81997/MusicStoreMobile |
First off, set your Target Framework to 7.1, the 0.45 release code is compiled prior to the 8.0 SDK release, this library does not yet work with the 8.0 SDK. It is possible the problem you are seeing is related to the incompatible Android binaries. Also I am unable to run the code in your Master branch. It starts a white screen then ends immediately on a Nexus 6p. |
sorry, I forgot that I tested the torrent library, because of this and ending immediately the application. already corrected you will see the logon page and the audio player notification (https://github.com/ragnarek81997/MusicStoreMobile/blob/master/MusicStoreMobile.Droid/Views/AudioPlayerView.cs) |
Your Projects are still compiling with 8.0. Putting that aside, the player starts, plays the Aaron Neville song, not sure where your crash is? |
here https://github.com/ragnarek81997/MusicStoreMobile/blob/master/MediaManager.Android/MediaSession/MediaSessionManager.cs |
After that you will hear music, but notifications will not appear, this is a problem |
I removed the MediaManager Projects and replaced them with the 0.45 Nuget package and music plays with no issues and the Notifications appear with no issues or crashes on a Nexus 6p with Oreo installed. I don't know what else you may have changed in the MediaManager Projects that are causing the problem or when you pulled the code, there may be code in the branch that hasn't been fully regression tested prior to a Nuget release. However I am actively using the develop branch code with no issues. If the Nuget package works, I have to assume that something has changed in your MediaManager Projects that is causing your issue. I would recommend using the Nuget package or going back to the 0.45 tag or at least using the most current commits in the develop branch. |
did you use monodroid 8.0? |
I did, but wouldn't recommend it. You may run into other issues. I used your exact code, unchanged except for adding the Nugets and removing the other projects. |
I did what you put in, but I do not see notifications, although music is playing. |
I have also verified backwards compatibility by testing this exact same solution on an Android 5.0 device, the music plays and the notification displays with no issue. |
fragment of output
|
output on build droid project, maybe there is a problem
|
I sent you a PR to your repository with the code changes that work on my side. Best of luck. |
Thank you very much for your help! |
I have a problem when creating an object of MediaSessionCompat.
Exception:
Java.Lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
Temporarily solved this problem by calling in a ui thread (if so you can call it):
After this notice began to work, but not stable. Somewhat improved the situation of the call of the body of the method UpdatePlaybackState in the ui stream (again, this is not quite a normal method call in the ui thread):
What is the essence of the problem? how can i fix better?
Thanks.
The text was updated successfully, but these errors were encountered: