Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action Buttons on the Push Notification #100

Closed
omxie opened this issue Dec 5, 2022 · 1 comment
Closed

Action Buttons on the Push Notification #100

omxie opened this issue Dec 5, 2022 · 1 comment

Comments

@omxie
Copy link

omxie commented Dec 5, 2022

Hi there,

I am trying to send a notification to the device with 3 action buttons and perform certain tasks on click of those buttons. Is it possible to use the plugin to do so? or does it have to be implemented something natively.

Thanks!

@TobiasBuchholz
Copy link
Owner

For android you can change the appearance of the default push notification and therefore add your 3 action buttons by setting the static NotificationBuilderProvider Func of the android FirebaseCloudMessagingImplementation class:

...
    FirebaseCloudMessagingImplementation.NotificationBuilderProvider = CreateNotificationBuilder;
...

private static NotificationCompat.Builder CreateNotificationBuilder(FCMNotification notification)
{
    return new NotificationCompat.Builder(_context, ChannelId)
        .SetSmallIcon(Resource.Drawable.ic_push)
        .TrySetBigPictureStyle(notification)
        .SetContentTitle(notification.Title)
        .SetContentText(notification.Body)
        .SetPriority(NotificationCompat.PriorityDefault)
        .SetAutoCancel(true);
}

For iOS I think you'll need to add an iOS extension project to customize your push notifications. Last time I checked this wasn't possible for .NET MAUI applications yet, but maybe it's now. If you are successful implementing it that way, please let us now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants