Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to go to SPECIFIC PAGE when user clicks on Push Notification

BoscoBosco USUniversity ✭✭

I have a Xamarin.Forms app (XF 1.3.4) that uses Azure Messaging to connect with GCM and APNS. The app works great - the app registers for push notifications, and push notifications are received successfully from Azure Notification Hubs on iOS and Android.

My question - how do I get my app to launch into or display a specific page when the user taps on a push notification, (1) when the app isn't running, AND (2) when the app is already running???

I've seen this question asked a few times in the forums, but I haven't seen a cohesive/detailed response yet.

Can someone please provide an answer with source code, or point me to a solution online that explicitly shows how to pass data from a push notification, through the platform-specific code, to the PCL code? ALSO, I don't want or need to integrate with another plugin (Push Notifications Plugin or otherwise) - I have push notifications working, I just need to make them content-aware.

Thanks!

Best Answer

Answers

  • valentinamaugerivalentinamaugeri USMember

    I also like @Barry I am looking for a solution to this problem. Someone has resolved?

  • @valentinamaugeri @Bosco Did you guys manage to find a solution for this?

  • BoscoBosco USUniversity ✭✭

    No, I never found a solution for this - clicking on a notification just launches the app,

  • faceoffers28faceoffers28 USUniversity ✭✭✭

    @Digogeorge answer worked for me... I searched all day for this. Thanks!

  • soufianemarlysoufianemarly Member ✭✭✭

    @faceoffers28
    Hi,

    what should we add in
    //Do your action /navigation

    like in exemple if type = EVENTS
    i want to redirect the user to EventPage

    How can i do that
    thank you

  • NishantSaxenaNishantSaxena Member
    edited July 29

    @soufianemarly
    If you want to navigate to a content page/ tabbed page (typical xamarin views ), you can use something like -
    App.NavigationPage.Navigation.PushAsync(new ());

    Here is my complete code -

    protected override void OnNewIntent(Intent intent)
    {
    var type = intent.GetStringExtra("Type");
    if (!string.IsNullOrEmpty(type))
    {
    App.NavigationPage.Navigation.PushAsync(new ());
    }
    }

Sign In or Register to comment.