To create a notification system in Unity for Android, you need the Android notification library, then write a public void function whit DateTime type argument and create a notification channel inside it, then create the notification itself in that function and finally send it to the Android notification center.
Finally, call this function where you want
for example:
public void notificationSchedule(DateTime time)
{
const string ChannelID = "notification";
AndroidNotificationChannel notificationChannel = new
AndroidNotificationChannel
{
Id = ChannelID,
name = "notification:,
description = "random description",
Importance = Importance.Default
};
AndroidNotificationCenter.RegisterNotificationChannel(notificationChannel);
AndroidNotifition notification = new AndroidNotifition
{
Titel = "AnyThing",
text = "anyThing" ,
smallIcon = "default",
largIcon = "default",
FireTime = time
};
AndroidNotificationCenter.SendNotification(notification ,ChannelID);
}
Top comments (0)