Demonstrates how the MvvmCross 5 IMvxNavigationService
doesn't seem to account for a scenario where you need to navigate to a MvxViewModel
from an Android notification via PendingIntent
.
Sometimes there is a need to show an Android notification to the user that brings up an activity when clicked. MvvmCross versions before 5.0 was able to handle this scenario properly while MvvmCross 5.5 doesn't currently seem to handle this, or the way to do it has changed significantly.
This program presents an activity with two buttons:
- Show Notification for OldViewModel
- Show Notification for NewViewModel
Each button triggers a notification with SetContentIntent
set so an activity is opened after the notification is clicked.
- Click the "Show Notification for OldViewModel" button to trigger the Android notification.
- Click the Android notification.
OldActivity
will be displayed. - Notice how the
RandomNumber
andMessage
passed in to theINotificationService
are both properly displayed on the screen. You will also seeMvxLog
messages indicating the old navigation methodsStart
,Init
are called. - Click the "Close" button to close
OldActivity
. - Click the "Show Notification for NewViewModel" button to trigger the Android notification.
- Click the Android notification.
NewActivity
will be displayed. - Notice how the
RandomNumber
is 0 and theMessage
isnull
(default values). You will also not seeMvxLog
messages indicating the new navigation methodPrepare
is called.Initialize
is called as expected.