Xamarin MediaMager notifications on Android - xamarin

I use the following code to start playing a local audio file. To my disappointment, no notification is shown on my Android emulator. After some digging, I notice that the Android MediaNotificationManager has all the code commented out.
I can see from a few other on GitHub, that other people does seem to have notifications (ironically, a few people seem to have problems getting rid of them - Example), so what do I need in order to get it?
IMediaFile mediaFile = new MediaFile(playRequest.Path, MediaFileType.Audio, ResourceAvailability.Local);
mediaFile = await CrossMediaManager.Current.MediaExtractor.ExtractMediaInfo(mediaFile);
await CrossMediaManager.Current.Play(mediaFile);
CrossMediaManager.Current.MediaNotificationManager.StartNotification(mediaFile);
CrossMediaManager.Current.MediaNotificationManager.UpdateNotifications(mediaFile, MediaPlayerStatus.Playing);

I found a reason. Notifications on Android require an Icon. By inspecting the source code of MediaNotificationManager, I found that on Android it actually handles notifications in a completely other class: MediaNotificationManagerImplementation found in MediaSession.
There, I also learned that it will look for an icon of type Android.Graphics.Bitmap in the property Art on the metadata. Curiously, the property ArtUri is not used for anything.
If this property is null, it will look for a drawable in resources, with the name xam_mediamanager_notify_ic. If none is found, it will use the application icon.
Now, this solves all my needs for Android. However, it's handled quite differently on other platforms, and I've yet to find out how to set the art on UWP (and I've not tested iOS yet).

Related

What is the reason for xamarin app style change?

I'm from Ukraine, so I immediately apologize for my crooked English. I got one very incomprehensible problem with which I can not figure it out. I have created a mobile application for Android and IOS. Absolutely normal application. I tested it on the emulator on several phones. But on one of them, the app didn't look like itself. For some reason it became dark and looked strange (I attached the screenshots). The normal version is white-green, this version was dark. I can't figure out what is the reason. Immediately I will say that the phone is normal and the light theme is enabled on it, the phone has standard settings. And everything else on this phone except this application is displayed normally. Please tell me what is the reason
I tried to change the themes and settings of the phone, and found out that the problem is definitely not in them
enter image description here

Xamarin: InitializeComponent () is too complex

I am currently developing an App for IOS and Android with Xamarin Forms. I am debugging with my Android device.
Starting yesterday, when trying to build and test my solution, it falls into a break state before the App is even loaded.
The exception is:
System.InvalidProgramException: Method wuut.Discover:InitializeComponent () is too complex.
It works when I unplug my Android device and open the App on developer mode. But I really need the Console etc. so right now, I am unable to continue developing my app.
I looked up the exception on Google but couldn't really find anything similar to my problem.
The error occurs inside InitializeComponent on one of my Contentpages containing an AbsoluteLayout.
The AbsoluteLayout is rather big with 5400 Lines of Code. So looking into the error messages, I tried to remove a few chunks of my XAML and it started working again.
So my question is: Does XAML or Xamarin have some limitations on how big an AbsoluteLayout/Contentpage should be? If not, how would I resolve this issue?
Thanks in advance and kind regards

Xamarin form: icons/image not showing which usually work before

Having problem not showing the ffimageloading image on the listview on iOS12.1.3 later by the client and it happened many time even though not always but it works on my local ipad, which i am not sure how to tackle.
Now it looks like also affecting the android devices. The client used to be working and it's now not working
I have initialize the init function in AppDelegate which is required otherwise my device also won't see.
Only thing i have inside was an delayloading and downSampleToViewSize which i am not sure what cause it.

Configure platform page with platform specific options

We've begun evaluating Xamarin for a up and coming project involving both iOS and Android, with the overriding intention to produce a single UI layer (and some share code, obviously) (I'm also new to C#)
TL;DR
I've begun exploring Xamarin on iOS. I started with the Phoneword example and it worked well enough.
The first issue I found was running the code on the iPhone X, which I was able to solve by using MainPage.On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); in the platform App class
While testing this, I noticed some issues with the ListView not scrolling properly (the core issue was actually with the platform padding).
I then used (MainPage as Xamarin.Forms.NavigationPage).On<iOS>().EnableTranslucentNavigationBar(); to enable translucent navigation bars (as we're targeting iOS 11+) and now everything appears under the navigation bar.
This is easily fixed in xCode and after some research I've found that I need to be using UIKit.UIViewController.EdgesForExtendedLayout Property, the immediate problem I'm facing is, the only "snippets" of code I can find are from the View is displayed under status bar in iOS 7 and EdgesForExtendedLayout doesn't help forum post.
Issue at hand...
The example solution snippets posted seem to be making use of a platform (iOS) specific solution. The problem is, I want to keep using the "cross-platform" code in the "platform" project and simply provide some custom configuration for the iOS platform which can apply these states.
I understand it could be possible to use a renderer, but this seems to counter-interactive, as I'd need one for both iOS and Android, where the platform page is doing just fine as it.
I understand that I could setup a DependencyService, but this seems annoying to have to include a specific "configuration" service just to solve this issue for iOS
I was hoping it might be possible to setup a iOS Page which would "override" some of the functionality of the platform page and would allow me to make use of things like viewDidLoad so I can apply the iOS specific configurations on a page by pages bases, so we could keep the platform page as it, but when running under iOS, it would provide me access to iOS life cycle of the actual view...
I've been trying to search the documentation and tutorials and haven't yet come across anything which would seem to do this or something similar (not to say there isn't one, but I'm just not finding it).

Is it possible to prevent your app from appearing as an extension for specific apps?

I've built an Action Extension for my app, and when i choose to Open In... something from inside of my app, I appear as an extension for myself. This UX is kinda weird, but also, it doesnt even work when i try to be an extension of myself.
I dont see anything in the documentation that specifies responding apps aside from NSExtensionActivationRule?
This is not possible at the moment in iOS 8.0

Resources