DEV Community

Steve Groner
Steve Groner

Posted on

Single vs. Multi Page Android App

I wrote an App that was a single page using MVVM and I was just using a frame to hide/unhide areas. This is a location tracking app. When it was a single page when minimized or the screen was locked tracking and everything worked perfect.

I then found some issues with modifying map features when the frame it was in wasnt visible so I needed to change it to a multipage app.

For some reason now, when I go from Page 1 to the actual map page the map gets displayed, but as soon as the screen locks or the app is moved to background, the OnDisappearing event on the map page is fired.

I can stop it by changing the MainActivity from inheriting global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity to inheriting FormsApplicationActivity but that seems to create additional issues

I can also stop it by loading the map page (page 2) as a PushModalAsync page. This way caused the app to crash alot.

changing the page inheritance works better, but it seems like it cannot fire messages using message center that I have in the onAppearing event of the mapPage.xaml.cs file.

Any thoughts on how to keep the app running, and updating in the background in a multi page environment?

Top comments (0)