I have a service (Foreground, STICKY), and an activity (LaunchMode.SingleTask) in the same app.
There are 2 mvvmcross setup scenarios:
- Service is started from boot, mvvmcross is initialized with the 'setup.EnsureInitialized' method
- Service is started from the Activity, and mvvmcross is initialized the 'classic' way
Sometimes because of low memory pressure, or unexpected exception, my service is killed or dies.
I tap then on my launcher,
10-13 01:05:06.699 497 507 I ActivityManager: START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=LoneWorker.Client.Android.App/loneworker.client.android.app.TrialSplashScreen bnds=[240,223][360,379] u=0} from pid 11747
10-13 01:05:06.769 497 7269 I ActivityManager: Start proc LoneWorker.Client.Android.App for activity LoneWorker.Client.Android.App/loneworker.clientandroid.app.views.HomeView: pid=11980 uid=10081 gids={3003, 1015, 1023, 1028}
but then the splash screen doesn't appear like a normal app start, and the application fails right away.
10-13 01:05:07.959 11980 11980 I MonoDroid: UNHANDLED EXCEPTION:
10-13 01:05:07.969 11980 11980 I MonoDroid: System.NullReferenceException: Object reference not set to an instance of an object
10-13 01:05:07.969 11980 11980 I MonoDroid: at Cirrious.CrossCore.Mvx.Resolve<Cirrious.MvvmCross.Plugins.Messenger.IMvxMessenger> () <0x00038>
10-13 01:05:07.969 11980 11980 I MonoDroid: at LoneWorker.ClientAndroid.App.Views.HomeView..ctor () <0x0002f>
10-13 01:05:07.969 11980 11980 I MonoDroid: at (wrapper dynamic-method) object.ee0d83da-1657-4884-bf34-4fc266ad42f0 (intptr,object[]) <0x0003f>
10-13 01:05:07.969 11980 11980 I MonoDroid: at Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) <0x00283>
10-13 01:05:07.969 11980 11980 I MonoDroid: at (wrapper dynamic-method) object.2fd07179-5f93-420a-8653-1fbe1c8a2f2e (intptr,intptr,intptr,intptr,intptr,intptr) <0x0006b>
In the log I have just an exception because the messenger couldn't be resolved by the Mvx container. => It can't be resolved simply because the setup process doesn't start. It behaves like the app was already initialized...
So does the previous app singleton from the previous crashed service is still up somewhere ?
Can I force the app to reinitialize ?
I'm a bit confused by this strange behavior...