How to change application's MainPage when the app is in the background

Hi all,

We are developing a multiplatform app (UWP, Android, & iOS) and encountered a bug in Android.

Basically, we have a first loading screen when we download a set of data. Upong loading, it navigates by changing the MainPage of the activity to the home page.

When setting the MainPage, a fragment transaction is triggered internally, which will throw an exception upon committing it when the app is in the background.

In order to circumvent that, we added a temporary property while the app is paused helding the next page, and then navigating to it on the OnResume method.

However, Android 4.4 (specifically the enterprise devices Honeywell CT-50 and Zebra TC-75) will continue to crash, with an IllegalStateException due to calling commit before OnRestoreInstanceState being called. This is stated in:

In order to, yet again, circumvent this problem, we hijacked the Android OnPostResume method, and notified of it to the Forms application so that we defer updating the page until then.

This is working correctly, however it feels a rather brittle approach, having to keep track of whether the app is paused or not on our own, keeping a property with the next page and so on...

Is there any facility to cover for our use case (long operation that can finish in the background that modifies the MainPage)?

Sign In or Register to comment.