Answer the question
In order to leave comments, you need to log in
How to make notifications in the android curtain disappear after clicking?
I am writing a simple game in Unity.
I use standard push notifications, I just send a push with text at the right time.
When you click on the push, the game opens, everything is fine.
The push itself from the Android notification curtain does not want to disappear, it hangs constantly.
What could be the problem?
Answer the question
In order to leave comments, you need to log in
From documentation :
Notification ID
Unity normally generates a unique ID for each notification after you have scheduled it. The example below shows how to get the generated notification ID.
var id = AndroidNotificationCenter.SendNotification(notification, "channel_id");
You can use this ID to track, cancel, or update a notification. The following example shows how to check the notification status and take some action based on the result. Notification status tracking only works on Android 6.0 Marshmallow and above.
var notificationStatus = AndroidNotificationCenter.CheckScheduledNotificationStatus(id); if (notificationStatus == NotificationStatus.Scheduled) { // Replace the scheduled notification with a new notification. AndroidNotificationCenter.UpdateScheduledNotification(id, newNotification, "channel_id"); } else if (notificationStatus == NotificationStatus.Delivered) { // Remove the previously shown notification from the status bar. AndroidNotificationCenter.CancelNotification(id); } else if (notificationStatus == NotificationStatus.Unknown) { AndroidNotificationCenter.SendNotification(newNotification, "channel_id"); }
// Remove the previously shown notification from the status bar.
AndroidNotificationCenter.CancelNotification(id);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question