I realize this is old but figured I'd post my experience :-)
Here's a few SO posts I found with some things people have done to handle screen rotation behaviors
I'm still kind of new with Android but my solution was to save the viewmodel into a static variable that's part of the Activity
protected override void OnSaveInstanceState(Bundle outState)
{
base.OnSaveInstanceState(outState);
MyViewModel = ViewModel;
}
Then when it comes back from a saved state
protected override void OnCreate (Bundle savedInstanceState)
{
if (MyViewModel == null || savedInstanceState == null)
{
ViewModel = new CreateNewVM();
}
else
{
ViewModel = MyViewModel;
MyViewModel = null;
}
And then my case might be different then yours because I'm using a page adapter so in that I override
public override Java.Lang.Object InstantiateItem(Android.Views.ViewGroup container, int position)
{
var fragment = (Fragment)base.InstantiateItem(container, position);
((CastFragmentToSomething)).ViewModel = ViewModel //I did a cast here instead of just using IViewFor because the IViewFor.ViewModel doesn't throw a property change
}
And then there as the fragments get created I set the ViewModel that was retained between states
That's probably all a little bit hacky but it seems to be working fine :-) I've tested with tombstoning and rotating and everything seems to load up successfully.. My guess is that this solution isn't that great for cases when the process is in the background and android decides to come along and GC the statics because of memory pressure... But for the sole purpose of just staying operational when you rotate the screen it seems to work fine..
I think the prettier solution would be to just serialize the VM And then "Cache" what the large data load items are.... So probably just serialize the VM so it retains state and then using Akavache to hold the expensive data and re-saturate the VM in a pretty small amount of time.
But what I have above is working so I'll leave it until I get a random crash around some Life Cycle nuance of android I'm currently unaware of:-)