Open Mvvmcross App Via Link With Data
In native Android apps you can define an intent-filter for an activity in the Manifest file which can open the app when a specific link (e.g. myprotocol://mysite.com/action/data) i
Solution 1:
I have an app that responds to scanning NFC tags and I have a similar situation.
My solution is to add the following in my OnCreate
override right after I call base.OnCreate(bundle)
:
if (null == ViewModel)
{
//This should only happen when the Intent is not an Mvx one. I.e. when having scanned//NFC tag. We need to load the ViewModel manually.var loaderService = Mvx.Resolve<IMvxViewModelLoader>();
ViewModel = (ScanViewModel) loaderService.LoadViewModel(
new MvxViewModelRequest(typeof (ScanViewModel), null, null, null), null);
}
As the comment says, the Intent is not one coming from MvvmCross. This means the bundle which tells MvvmCross which ViewModel to load is not present. So what I do is to create the ViewModel myself.
Post a Comment for "Open Mvvmcross App Via Link With Data"