Skip to content
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

[BUG] .NET MAUI 8.0 Android 14: AndroidX.LocalBroadcastManager.Content.LocalBroadcastManager not supported on Android 13 and above. #2293

Open
2 tasks done
giannistek1 opened this issue Oct 18, 2024 · 1 comment
Labels
bug Something isn't working 📽️ MediaElement Issue/PR that has to do with MediaElement unverified

Comments

@giannistek1
Copy link

giannistek1 commented Oct 18, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

For context, I use an Android 14 Samsung Galaxy A34 and a .NET 8.0 MAUI app.

And I use MediaElement version 4.0.1 because 4.1.1 kept crashing, I did not bother updating.

Sentry keeps giving me this message (ever since I started using MediaElement 1-2 months ago):
AndroidX.LocalBroadcastManager.Content.LocalBroadcastManager not supported on Android 13 and above.

Because src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs: line 10 says:
using AndroidX.LocalBroadcastManager.Content;

Very annoying and makes no sense because, yes I am using a newer Android version, shouldn't the code be updated to support Android 13+?

How do I turn this off or prevent this from sending or will there be a fix?

I googled a bit and someone said that it should be Android.Support instead of AndroidX.

Full call stack:
?, in void Logger.Log(LogLevel, EventId, TState, Exception, Func<TState, Exception, string>)+LoggerLog(LogLevel, EventId, ILogger, Exception, Func<FormattedLogValues, Exception, string>, ref List, in FormattedLogValues)
?, in void Logger.Log(LogLevel, EventId, FormattedLogValues, Exception, Func<FormattedLogValues, Exception, string>)
?, in void LoggerExtensions.Log(ILogger, LogLevel, EventId, Exception, string, params object[]) x 2
?, in void LoggerExtensions.LogError(ILogger, string, params object[])
?, in void MediaManager.BroadcastUpdate(string action)
?, in async void MediaManager.OnPlayerStateChanged(bool playWhenReady, int playbackState)
?, in void AsyncMethodBuilderCore.Start<d__19>(ref d__19)
?, in void MediaManager.OnPlayerStateChanged(bool playWhenReady, int playbackState)
?, in void DynamicMethodNameCounter.14(IntPtr, IntPtr, bool, int)
?, in void JniNativeMethods.wrapper_native_indirect_void_intptr_intptr_intptr_intptr(ref IntPtr, IntPtr, IntPtr, IntPtr, IntPtr)
?, in void InstanceMethods.CallVoidMethod(JniObjectReference, JniMethodInfo, JniArgumentValue*)
?, in void JNIEnv.CallVoidMethod(IntPtr, IntPtr, JValue*)
?, in void IExoPlayerInvoker.SeekTo(long positionMs)
?, in void MediaManager.PlatformStop()
?, in void MediaManager.Stop()
?, in void MediaElementHandler.MapStopRequested(MediaElementHandler handler, MediaElement mediaElement, object args)
File "//src/Core/src/CommandMapper.cs", line 105, col 38, in void CommandMapper<TVirtualView, TViewHandler>.Add(string key, Action<TViewHandler, TVirtualView> action)+(IElementHandler h, IElement v, object o) => { }
File "/
/src/Core/src/CommandMapper.cs", line 29, col 4, in void CommandMapper.InvokeCore(string key, IElementHandler viewHandler, IElement virtualView, object args)
File "//src/Core/src/Handlers/Element/ElementHandler.cs", line 92, col 4, in void ElementHandler.Invoke(string command, object args)
?, in void MediaElement.Stop()
?, in void AudioPlayerControl.StopAudio()
?, in void MainPage.OnStopSongPart(object sender, EventArgs e)
?, in async void SearchSongPartsView.SonglibraryListViewItemTapped(object sender, ItemTappedEventArgs e)
?, in void AsyncMethodBuilderCore.Start<d__30>(ref d__30)
?, in void SearchSongPartsView.SonglibraryListViewItemTapped(object sender, ItemTappedEventArgs e)
?, in bool SfListView.RaiseItemTapped(ItemTappedEventArgs e)
?, in void SelectionController.HandleTouchInteraction(TouchGesture gesture, ListViewItemInfoBase itemInfo, Point position)
?, in void ListViewItemInfoBase.HandleTouchInteraction(TouchGesture gesture, Point position)
?, in void ListViewItem.OnTap(TapEventArgs e)
?, in void GestureDetector.OnTapped(Point touchPoint, int tapCount)
?, in bool ScrollListener.OnSingleTapUp(MotionEvent e)
?, in bool SimpleOnGestureListener.n_OnSingleTapUp_Landroid_view_MotionEvent
(IntPtr jnienv, IntPtr native__this, IntPtr native_e)
?, in bool JNINativeWrapper.Wrap_JniMarshal_PPL_Z(JniMarshal_PPL_Z callback, IntPtr jnienv, IntPtr klazz, IntPtr p0)
?, in byte JniNativeMethods.wrapper_native_indirect_byte_intptr_intptr_intptr_intptr(ref IntPtr, IntPtr, IntPtr, IntPtr, IntPtr)
?, in bool InstanceMethods.CallBooleanMethod(JniObjectReference, JniMethodInfo, JniArgumentValue*)
?, in bool JniInstanceMethods.InvokeVirtualBooleanMethod(string, IJavaPeerable, JniArgumentValue*)
?, in bool GestureDetector.OnTouchEvent(MotionEvent)
?, in void GestureDetector.PlatformView_Touch(object sender, TouchEventArgs e)
?, in bool IOnTouchListenerImplementor.OnTouch(View, MotionEvent)
?, in bool IOnTouchListenerInvoker.n_OnTouch_Landroid_view_View_Landroid_view_MotionEvent
(IntPtr jnienv, IntPtr native__this, IntPtr native_v, IntPtr native_e)
?, in bool JNINativeWrapper.Wrap_JniMarshal_PPLL_Z(JniMarshal_PPLL_Z callback, IntPtr jnienv, IntPtr klazz, IntPtr p0, IntPtr p1)
?, in byte JniNativeMethods.wrapper_native_indirect_byte_intptr_intptr_intptr_intptr_intptr(ref IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr)
?, in bool InstanceMethods.CallNonvirtualBooleanMethod(JniObjectReference, JniObjectReference, JniMethodInfo, JniArgumentValue*)
?, in bool JniInstanceMethods.InvokeVirtualBooleanMethod(string, IJavaPeerable, JniArgumentValue*)
?, in bool Activity.DispatchTouchEvent(MotionEvent)
File "/
/src/Core/src/Platform/Android/MauiAppCompatActivity.cs", line 47, col 4, in bool MauiAppCompatActivity.DispatchTouchEvent(MotionEvent e)
?, in bool Activity.n_DispatchTouchEvent_Landroid_view_MotionEvent_(IntPtr jnienv, IntPtr native__this, IntPtr native_ev)
?, in bool JNINativeWrapper.Wrap_JniMarshal_PPL_Z(_JniMarshal_PPL_Z callback, IntPtr jnienv, IntPtr klazz, IntPtr p0)

All the dots are all the same pointless messages, I think they get sent each time the MediaPlayer state gets updated (when its playing, pausing, stopped).
Image

Expected Behavior

No more messages or fix for Android 13 and above.

Steps To Reproduce

Not entirely sure how to reproduce it. As long as the BroadCastmanager gets used on an Android device with version 13 or higher.

Link to public reproduction project repository

https://github.com/giannistek1/rpd-player/tree/main

Environment

  • .NET MAUI CommunityToolkit: 9.1.0
  • .NET CommunityToolkit.Maui.MediaElement: 4.0.1
  • OS: Android 14
  • Phone: Samsung Galaxy A34 5G
  • .NET MAUI: 8.0

Anything else?

The message also classifies as an error. Don't know why.

Image

@giannistek1 giannistek1 added bug Something isn't working unverified labels Oct 18, 2024
@vhugogarcia vhugogarcia added the 📽️ MediaElement Issue/PR that has to do with MediaElement label Oct 23, 2024
@ne0rrmatrix
Copy link
Contributor

Can you test your project against this PR and reply back if it solves your issue? #2076 I am hoping to have it merged to main soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📽️ MediaElement Issue/PR that has to do with MediaElement unverified
Projects
None yet
Development

No branches or pull requests

3 participants