ποΈ Notifications
Notify your players of important, retention-driving, events that occur in your game.
Mobile has a natural retention mechanic; the home screen. With the web, there is no natural trigger to return to the game for the players. That is where notifications come in.
Early Feature
This feature is in a solidly working but early state. Do not hesitate to contact us with any issues, thoughts, or needs you might have. We're always happy to work alongside our partners to prioritize new features & updates.
What is NotificationsKit?
NotificationKit allows for quick and easy implementation of local notifications.
Pley makes sure that:
1) Notification behavior, visuals, and user experience are all excellent.
2) Notification permissions (allow/disallow) are automatically handled.
3) Support across browsers / operating systems are maintained.
4) Impact on player retention is actively monitored and optimized.
All you have to do is implement them in your game - Pley handles everything else.
Local Notifications vs. Push Notifications.
These are the two types of notifications used in mobile games.
For now, web games currently only support local notifications.Local notifications are scheduled and triggered by the game client, received by Pley's service worker run in the browser. (Ex. building complete in 2 hours and sending a notification to the user once it is finished.)
Push notifications are sent by the game backend (or from another non-client source). This can be done at any time to any player (Ex. "Holiday Event has begun!" or "Your village was attacked", sent while the game is not running).
Scheduling Local Notifications
When a notification is scheduled for a user for the first time, they will be prompted to grant (or deny) notification permissions. This is automatically managed for you - all you have to do is schedule notifications. If you are interested, notification behavior can be found here.
When scheduling a notification, 5 things are defined:
1) Notification Title
2) Notification Body
3) Image Path
4) Icon Path
5) Timespan delay until notification should be delivered

Example notification on Windows 11 with Google Chrome. May look vastly different depending on OS and browser version.
To schedule notifications, you just need to call 'ScheduleNotification(Title, Body, ImagePath, IconPath, TimeDelay)'.
Pley will automatically manage everything else for you.
// Schedule notifications
// Remember to initialize the SDK first.
using Trail;
//Notification will be delivered in 10 minutes
var delay = TimeSpan.FromSeconds(600);
// Image paths are relative to the 'StreamingAssets'-folder
var imagePath = "notification_image.png";
var iconPath = "notification_icon.png";
Trail.NotificationsKit.ScheduleLocalNotification("Notification title", "Notification body", imagePath, iconPath, delay,
(result, notificationId) => {
if (result.IsOk())
{
Debug.Log($"Successfully scheduled notification in {delay} seconds: {notificationId}");
}
else
{
Debug.LogError($"Failed to schedule notification in {delay} seconds: {result}");
}
});
If there is a need, the SDK also allows you to cancel scheduled notifications using the SDK methods below.
- CancelScheduledNotification(notificationId) removes a single specified notification.
- CancelAllScheduledNotifications() removes all notifications that have been scheduled.
// Remember to initialize the SDK first.
using Trail;
// Cancel specific notification by Notification ID
Trail.NotificationsKit.CancelScheduledNotification(notificationId);
// Cancel all notifications
Trail.NotificationsKit.CancelAllScheduledNotifications();
Remember: Local Notifications
Local notifications are just that; local. They are scheduled by the Pley SDK within the clients browser, held there for the set time delay, and then delivered to the user. This means that notifications are always unique to each user and cannot be affected, controlled, or modified by an external server.
What about push notifications?
Sadly, the system providers for push notifications on mobile do not support web-based games. That said, a replacement system to allow the use of push notifications in web games is on our feature roadmap, so stay tuned!
Updated 23 days ago