I am trying to load a Xamarin Forms page from an Android Notification. I am really lost on the android side of this, and most of my code has been pieced together from tutorials
Problem is with your code Intent LoadPostPage = new Intent(Forms.Context, typeof(DroidToForms));
.
For Android platform of XF project, it only has one Activity
, which is MainActivity
, or pages of XF are rendered based on this MainActivity
.
So you may change you code like this:
Intent intent = new Intent(context, typeof(MainActivity));
intent.PutExtras(valuesForActivity);
PendingIntent resultPendingIntent = PendingIntent.GetActivity(Xamarin.Forms.Forms.Context, 0, intent, PendingIntentFlags.OneShot);
Then in your OnCreate
method of MainActivity
:
//navigate to the page of PCL
Xamarin.Forms.Application.Current.MainPage.Navigation.PushAsync(new PostPage());
At last, as @Pratik suggested, if you want to create a native page/ view for Android platform, use PageRenderer
or ViewRenderer to do so.