Forum Xamarin.Forms

How to use click_action in Firebase Cloud Messaging Notification

Hi Experts,

I want to know how to use this property in android project to open an specific activity , i need to know when the app start by notification tapped

Thanks in advance!

Best Answer

Answers

  • cahyoagungcahyoagung Member ✭✭
    edited June 4

    @LandLu can we use MainActivity as a click action ? instead of create a new SecondActivity

    When your application is on the background state you need to use click action. Register a specific activity like:

    [Activity(Label = "SecondActivity")]
    [IntentFilter(new[] { ".Activities.SecondActivity" }, Categories = new[] { "android.intent.category.DEFAULT" })]
    public class SecondActivity : Activity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
    
            // Create your application here
            // ...
        }
    }
    

    .Activities.SecondActivity here is your click action which you need to set in the notification payload.

Sign In or Register to comment.