thomasgalliker / Plugin.FirebasePushNotifications

Receive and handle firebase push notifications in .NET MAUI apps
MIT License
66 stars 5 forks source link

[Bug] Notifications with notification actions and priority <= default should not be displayed in foreground mode on Android #81

Closed thomasgalliker closed 1 month ago

thomasgalliker commented 1 month ago

Description

If notification messages with priority=default (or lower) are received on Android, while the app runs in foreground mode, the NotificationBuilder creates a notification popup which displays the notification actions for the given notification click_action. This behavior is not intended. The general idea is, if the priority is not specified (default) no extra popup should be shown while the app runs in foreground mode. It's the duty of the app to handle the incoming notification and display a custom UI or dialog. If the priority is set to high (or above) we always show a notification popup - even if the app runs in foreground.

Steps to Reproduce

  1. Start Android and keep it in foreground mode. 2a. Send notification with priority=default:
    {
    "message": {
        "topic": "general",
        "notification": {
            "title": "Medication Intake",
            "body": "Do you want to take your medicine?"
        },
        "data": {
            "priority": "high"
        },
        "android": {
            "notification": {
                "click_action": "medication_intake"
            }
        },
        "apns": {
            "payload": {
                "aps": {
                    "category": "medication_intake"
                }
            }
        }
    }
    }

2b. Send notification with priority=high:

{
    "message": {
        "topic": "general",
        "notification": {
            "title": "Medication Intake",
            "body": "Do you want to take your medicine?"
        },
        "data": {
            "priority": "default"
        },
        "android": {
            "notification": {
                "click_action": "medication_intake"
            }
        },
        "apns": {
            "payload": {
                "aps": {
                    "category": "medication_intake"
                }
            }
        }
    }
}

Expected Behavior

Actual Behavior

Basic Information