Example #1
0
        protected void NavigateToRequestIfPresent(Intent intent)
        {
            // If MvxLaunchData is present, we then know we should navigate to that intent
            string requestText = intent.GetStringExtra("Request");

            if (requestText == null)
            {
                return;
            }

            IMvxViewDispatcher viewDispatcher = Mvx.IoCProvider.Resolve <IMvxViewDispatcher>();

            IMvxNavigationSerializer converter = Mvx.IoCProvider.Resolve <IMvxNavigationSerializer>();
            MvxViewModelRequest      request   = converter.Serializer.DeserializeObject <MvxViewModelRequest>(requestText);

            viewDispatcher.ShowViewModel(request);
        }
        private PendingIntent GetContentIntent(Newsfeed newsfeed)
        {
            MvxBundle bundle = new MvxBundle();

            bundle.Write(newsfeed);

            MvxViewModelRequest <NewsfeedItemViewModel> request = new MvxViewModelRequest <NewsfeedItemViewModel>(bundle, null);

            IMvxNavigationSerializer converter = Mvx.IoCProvider.Resolve <IMvxNavigationSerializer>();
            string requestText = converter.Serializer.SerializeObject(request);

            Intent intent = new Intent(Application.Context, typeof(MainActivity));

            // We only want one activity started
            intent.AddFlags(flags: ActivityFlags.SingleTop);
            intent.PutExtra("Request", requestText);

            // Create Pending intent, with OneShot. We're not going to want to update this.
            return(PendingIntent.GetActivity(Application.Context, (int)(DateTimeOffset.Now.ToUnixTimeMilliseconds() / 1000), intent, PendingIntentFlags.OneShot));
        }