In Game Chat, push notifications are a core function that informs you of important information or updates in real time. Through this push notifications service, you don't miss any important message even when the app is in the background or the device is not activated. The following describes the push notifications functions of Game Chat.
Main functions of push notifications
Real-time notification: chat-related notifications such as new messages, member changes, and event invitations are immediately sent to you.
Customizable: you can customize the format and contents of the notifications suited for the application's requirements.
Multiple platforms supported: it supports push notifications for various mobile operating systems such as iOS and Android to expand the user base.
Battery and data efficiency: it minimizes battery consumption and data usage with the recent push technology and sends notifications efficiently.
Interactive notification: you can include interactive components to allow you to respond in the notification itself directly. For example, you can reply directly to a message, or respond to an invitation.
Implementation methods of push notifications
To implement the push notifications service, Game Chat API provides a few core components:
Register push tokens: you can register a push token of your device to the Game Chat server to allow sending a notification to the corresponding device.
Manage notification settings: you can set whether you will receive a notification depending on your preference for notifications.
Backend integration: the server side can create and send push notifications in real time by integrating with the backend of Game Chat.
Security and personal information protection
Data encryption: all push notifications are encrypted during transfer and protected from external access.
Compliance with the Personal Information Protection Act: Game Chat takes users' personal information protection very seriously, and provides notification services in accordance with related laws and regulations.
Through the push notifications function, Game Chat induces user participation, increases the application usage rate, and enhances user experience. You can be connected anytime, anywhere, so you don't miss important communication.
Android(Kotlin)
After adding the Android app in the Firebase Console, download the google-services.json file and place it in the root folder of your project app module.
After adding the file, include the following content in bundle.gradle.kts.
NChat.INSTANCE.setNotificationClickedHandler(notification -> {// Define the desired action when a push notification is clicked. String title =notification.getTitle(); String content =notification.getBody(); String channel =notification.getData() !=null?notification.getData().get("channel") :"";});
Android Push Data
This is a list of values delivered through the Android push click handler.
iOS(Swift)
Add app push notification permissions. Go to the Target's Signing & Capabilities, click the '+' in the top left corner, and select 'Capability > Push Notifications' to add.
Create a new AppDelegate.swift file or define the following content in the existing AppDelegate.swift.
Note
For push notifications in the sandbox environment, use
NChat.setPushToken(token: token, sandbox: true)
The sandbox value must be set to true for notifications to be received correctly.
Call setPushState to configure the push notification receipt status after connecting.