Search code examples
androidxamarin.androidxamarin.formsprism-6

Xamarin.Forms, Prism.Forms, Android Lolliop 5.1.1, Navigation transitions/animations


I have a problem when using Xamarin.Forms in conjunction with Prism.Forms (Unity) on an Android 5.1.1 (Lollipop) device.

Specifically, if I navigate to/from forms with "animation: true" those forms do not always work correctly afterward - specifically, the forms are not always updated in response to a PropertyChanged event. The forms work perfectly on Android 6.0 and 7.1 (the only other devices I have available for testing).

If I change all of my calls to INavigationService.NavigateAsync so that "animation" is false, those forms behave properly as long as I do not use the hardware "back" button to exit a form (as this then animates again). I have even created an override of the "UnityPageNavigationService" that overrides the "animated" parameter on calls to "DoPop", "DoPush" and "GoBackAsync" (I am pretty sure that the NavigateAsync method eventually calls one of these for all requirements except in the case of changing the content of a MasterDetailPage).

I am pretty sure that this is a Xamarin problem and not a Prism problem as having looked through the code on GitHub it appears to me that the Prism INavigationService implementation eventually comes back to the Page.Navigation.PushAsync(...) etc. methods and I am also pretty sure that the Prism navigation service is not intercepting the back button and interacting with it.

  • Is there any way to disable the animations when navigation is instigated by the hardware back button?

  • Is there a way to override the INavigation implementation for a platform (obviously Android in this instance)?

  • Is there a known issue and/or work-around here for Xamarin Forms on Lollipop 5.1.1?

I am using Xamarin Forms 2.3.4.231, Prism.Forms 6.3 and Prism.Unity.Forms 6.3.


Solution

  • I eventually resolved this and it was nothing to do with Prism Navigation nor Xamarin.Forms but was instead caused by the element of the AndroidManifest.xml not being the first child of the element.

    I had sorted the children of the element alphabetically making the last element and this broke it (though not on later versions of Android).