Xamarin.iOS: MPMusicPlayerController.NowPlayingItem property disappears - c#

I am trying to write a Xamarin.Forms-based app for playing music. I am using the standard Xamarin Forms Dependency Service pattern to create a platform-specific player for iOS which uses the MPMusicPlayerController as documented by Xamarin. When I write the code the MPMusicPlayerController.NowPlayItem property is accessible;
and when I first tested it everything worked OK. I then started trying to listen to notifications from the MPMusicPlayerController and it 'disappeared'; when I debug, the property is missing and when I try to access it I get a deep mono SIGSEGV exception;
Quite often the debugger tries to reference the property and also crashes. So; I took out the notifications and it still happens!

I recreated the part of the code causing the problem in Xcode and Objective C. Though looking at the Device log in Xcode after running and crashing from Xamarin would have shown the problem as well.
More recent versions of iOS expect an Info.plist entry; Privacy - Apple Music Usage Description to be provided for anything that accesses the Media Library. Interestingly it seems that playback is allowed and it feels like the NowPlayingItem property shouldn't be allowed but somehow, sometimes is.
In the end, I found I had to put the plist entry in and also had to check for and sometimes ask for authorisation as in this post.
Once I had done both of these, the NowPlayingItem property works and I get notifications.

Related

Unity Prefab Not Updating On Old Android Tablet

I have a Samsung Galaxy Tab Active 1, on the latest version of android it can handle, and just recently, after adding accessibility features that shouldn’t affect anything, the balls in my game stopped updating. I instantiate a ball, and change a few properties on it, and then for some reason I think it’s not calling the update method. There are no errors.
I’ve heard using PrefabUtility to instantiate might help, but I haven’t done that just yet. I will update if PrefabUtility works.
Any advice?
Whoops, this was due to me being a bit stupid. The main reason it was happening was because of a parsing error in some of the accesibility settings, as they were not saved correctly due to weirdness I can't wrap my head around with files in Android. TLDR: file did not save correctly, and so did not load correctly, and so data messed up, and so it errored before it could do anything.

C# UWP BluetoothLEDevice.FromIdAsync stop working

I'm developing a Bluetooth app using UWP framework under Visual Studio 2017. Everything is going well thanks to Microsoft Example (C# SDK Example BluetoothLE well written).
During my fourth day of development, the API BluetoothLEDevice.FromIdAsync in the line:
bluetoothLeDevice = await
BluetoothLEDevice.FromIdAsync(bleDeviceToConnect.Id);
Is no longer working, neither in my app, neither in the original sample from Microsoft I'm using as example (I don't touch anything on it).
I don't understand as I changed nothing (in my project properties, neither any Windows update on my computer). When I call the function, it just never return.
I tried my Bluetooth object used with some smartphone app, and my hardware is working well.
The call is made in a try but no exception is catch, the function just never return (and I wait some time, I don't even have a timeout).
Have you seen this? Any input on how to solve it?
I'm totaly stuck and can't go ahead as I can't connect at all any object now...
If your code and the example code are having the same problem, the only reasons can be that your device is not available.
It is out of reach or even switched off or already connected.
It can also be that if you are using the deviceManager or deviceWatcher, your OS is providing stale information.
For BluetoothLE the windows deviceManager and watcher are nothing but trouble.
Windows sometimes keeps the pairing information and connection status, even if the device is out of reach or switched off.
Many times you have to remove and and re-add your device in settings to make it available again or a restart is needed.
To save you from all these troubles, I advise you to use the advertisementWatcher.
If your device is found by the advertisementWatcher you know it is in reach and connectable, and there is no need to add your BLE-device in settings.
If needed I can provide a simple example.
This may happen because of COM security (as you may know UWPAPI based on WinRTYY which works above COM). This should help.
Hello All and thank you for your help on this.
I got a shot on an other computer and it works just fine.
I double check this morning and found out that even Widnows can't connect to anything over Bluetooth (I tried with the Bluetooth Speaker I'm usually using).
It was a Driver issue, I don't know how it happens, but my computer Driver just stop working, and I add to reinstall it.

Xamarin.Forms layout not being loaded after updating

Edit: Maps was not the problem, it's the forms itself as well.
In our app we are using Xamarin.Forms, and we used to use version 2.3.4.270 which was working fine. However, after updating to the current latest version 2.4.0.18342 and cleaning the solution, we just see a white screen without any exception. Note that not even a part of the actual layout is rendered at all. No code is changed.
This problem is on an Android device, iOS is working properly.
According to the release notes, there is nothing actually changed a lot in the Forms itself:
https://developer.xamarin.com/releases/xamarin-forms/xamarin-forms-2.4/2.4.0-stable/
Did Xamarin change something important in their switch from 2.3 to 2.4 that I am missing out here?
The white screen appears if you did not provide an API key, or if it not valid. Since your iOS project is working fine, my suggestion will be to check your declaration of API key for android.
https://developer.xamarin.com/guides/xamarin-forms/user-interface/map/#Android
Well the problem was that we were using MvvmCross, this caused several problems in our project so we decided to switch to another framework.

MvvmCross Monotouch - Fail to bind Properties on a real iPad, but it works on the Simulator

I am working with MvvmCross Monotouch.
Here is the Binding Code that actually works very well on the iOS Simulator.
{ this, "{'Title':{'Path':'NavigationBarTitle'}}
However, it does not work when I deploy it on my real iPad (iPad 2).
Application Output:
===================
MvxBind: Warning: 0.69 Failed to create target binding for from NavigationBarTitle to Title
I am glad to see it works on the iOS Simulator but, is there any reason why it does not work on the real iPad?
Patrick
One situation I've seen this type of error occur in is in release builds where the monotouch linker optimises the image size and removes the apparently unused property required for binding.
To workaround this, I generally include a fake bit of code to trick the linker into including the required properties - e.g. Here's a monodroid sample file which does the same sort of thing:
https://github.com/slodge/MvvmCross/blob/master/Sample%20-%20BestSellers/BestSellers/BestSellers.Droid/LinkerIncludePlease.cs
This is one of the disadvantages of using mvvmcross currently - it can lead to larger binary image sizes.

ClickOnce & XNA issues

I essentially have a blank XNA project built using the XNA 3.1 wizard, i'm testing whether a game i make can be "installed" on another computer without having to make them install everything manually to make it work.
The only additional code in the game is:
Components.Add(new GamerServicesComponent(this));
After going through the ClickOnce publishing stage i copied it to a USB drive and attempted to run the "setup.exe" on a Windows Vista computer with no Visual C#/Studio or XNA installed.
According to the MSDN entry the ClickOnce will actually include everything necessary to make the game work on the computer, yet after the installation i get the dreaded "... has stopped working" when i try to run it.
Does anyone know how to get around this? I assumed the reason it says it can be done is because it works.
Thanks
http://msdn.microsoft.com/en-us/library/bb464156.aspx
Edit:
Just noticed that the article states that the Games for Windows - LIVE is not included in the distributable, would this mean if it was included as a component in the XNA game it would cause the crash when i attempt to run it?
When an application says "has stopped working" for no immediately apparent reason, that's usually a sign that an unhandled exception has occured. Since MSDN states that the GamerServicesComponent class is not available without the XNA Game Studio installed, that seems like the most plausible explanation.
Why is it available, then? Well, you need something to program up against; you wouldn't be able to use auto-completion and such if you didn't have the class, because VS wouldn't know what it looked like
Getting it to compile for, say, XBox 360, where I would guess that the class CAN be used, probably wouldn't work either if it didn't know anything about the class.
To address the general problem of a ClickOnce application which "has stopped working" immediately, you can get more information on your particular problem by looking in the Windows Event Viewer:
http://windows.microsoft.com/en-US/windows-vista/Open-Event-Viewer
Like Michael mentioned, this is often an unhandled exception, but this way you can see WHAT the unhandled exception was.

Categories