AddLocalNotification/ClearLocalNotifications
AndroidiOS
If you were looking for the method for use with Unity, see AddLocalNotification for Unity SDK.
If you were looking for the method for use with Unity, see AddLocalNotification for Unity SDK.
caution
For Android devices, it is mandatory to configure ANDROID_LOCAL_NOTIFICATION_ENABLE
in INTLConfig.ini.
Local notifications are customized by users, saved locally, and triggered by time.
When the time set is earlier than the current time, the notification will be displayed immediately.
info
The message structures of Android and iOS are different.
Function definition
// Add local push for Android
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool AddLocalNotification(const FString Channel, const FINTLLocalNotification LocalNotification);
// Add local push for iOS
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool AddLocalNotificationIOS(const FString Channel, const FINTLLocalNotificationIOS localNotification);
// Clear local push
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool ClearLocalNotifications(const FString Channel);
Input parameters
AddLocalNotification
Parameter | Type | Description |
---|---|---|
Channel | FString | Channel definition For example: "Firebase" |
LocalNotification | FINTLLocalNotification | Local notification body |
AddLocalNotificationIOS
Name | Parameter Type | Description |
---|---|---|
Channel | FString | Channel definition For example: "Firebase" |
LocalNotification | FINTLLocalNotificationIOS | Local notification body |
Observers
The callback processing interface is PushResultObserver. The callback data structure is PushResult.
The callback methodID is kMethodIDPushAddLocalNotification
,kMethodIDPushClearLocalNotifications
.
Code sample
FINTL Local Notification message;
UINTLSDKAPI::AddLocalNotification("Firebase", message);
FINTL Local Notification iOS message;
UINTLSDKAPI::AddLocalNotificationIOS("Firebase", message);
Data structure
Android
FINTLLocalNotification
Member Variable Name | Type | Description |
---|---|---|
ActionType | int | Set action type 1: Open activity or app 2: Open browser 3: Open Intent 4: Open app through package name |
NotificationID | int | Specifies the notification ID. When a notification with the same ID has already been displayed, the older notification is overwritten. |
Title | string | Set message title |
Content | string | Set message content |
TickerText | string | Set ticker text content |
ActionParameter | string | When ActionType=1, ActionParameter can be the class name of the in-app activity.For example: com.intl.TestActivity. When ActionType=2, ActionParameter is a URL. When the user clicks the notification, this URL is directly opened in the browser. When ActionType=3, ActionParameter is a serial Intent. When ActionType=4, ActionParameter is the app package name. |
FireTime | long | Sets the notification trigger time, long type (timestamp in UTC time, units: seconds) |
SoundEnabled | int | Whether to play a sound 0: No 1: Yes Default: 1 |
RingRaw | string | Specifies the in-app sound (raw/ring.mp3). For example: android.resource://intlgame.demo/raw/ring |
SmallIcon | string | Specifies the small status bar icon (test.png) For example: test |
Lights | int | Whether to light up 0: No 1: Yes Default: 0 |
Vibrate | int | Whether to vibrate 0: No 1: Yes Default: 0 |
iOS
FINTLLocalNotificationIOS
Member Variable | Type | Description |
---|---|---|
NotificationID | string | [Required] Specifies the notification ID. When a notification with the same ID has already been displayed, the older notification is overwritten. |
RepeatType | int | Push resend cycle 1: minutes 2: hours 3: days 4: weeks 5: months 6: years Default: 0, indicates no resending |
FireTime | long | Local push trigger time |
Badge | int | Badge |
AlertBody | string | Push content |
AlertAction | string | Replace popup button text Default: Enabled |
UserInfo | List<Dictionary<string,string>> | Custom parameter, can be used to identify push notifications and add additional information |
AlertTitle | string | Short push description |