TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
211 stars 49 forks source link

NotificationTapped event not triggering on Android platform #134

Closed RsZoli closed 1 year ago

RsZoli commented 1 year ago

NotificationTapped event not triggering on Android platform, i have no information about iOS

I'm building against net7.0-android

.NET SDK: Version: 7.0.103 Commit: 276c71d299

.NET SDKs installed: 7.0.103 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Here is my code:

public partial class App : Application
{
    public App()
    {
        CrossFirebaseCloudMessaging.Current.NotificationTapped += Current_NotificationTapped;
        InitializeComponent();
        MainPage = new AppShell();
    }
    protected override void OnStart()
    {
        if (CrossFirebaseCloudMessaging.IsSupported)
        {
            CrossFirebaseCloudMessaging.Current.CheckIfValidAsync();
            CrossFirebaseCloudMessaging.Current.SubscribeToTopicAsync("update").GetAwaiter();
        }
        base.OnStart();
    }

    private void Current_NotificationTapped(object sender, Plugin.Firebase.CloudMessaging.EventArgs.FCMNotificationTappedEventArgs e)
    {
        Console.WriteLine(e.ToString());
    }
}
TobiasBuchholz commented 1 year ago

Hi, did you complete all android specific steps from the docs? You can also take a look at the sample project.

RsZoli commented 1 year ago

@TobiasBuchholz Hi, thank you for your response!

I'm sorry, it seams i left out those instructions, given that i'm developing on MAUI platform, i comletely ignored it, i believed its only for X.F! It is working now, thank you very much!