Skip to main content

AddLocalNotification/ClearLocalNotifications

AndroidiOS
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

ParameterTypeDescription
ChannelFStringChannel definition
For example: "Firebase"
LocalNotificationFINTLLocalNotificationLocal notification body

AddLocalNotificationIOS

NameParameter TypeDescription
ChannelFStringChannel definition
For example: "Firebase"
LocalNotificationFINTLLocalNotificationIOSLocal notification body

Observers

The callback processing interface is PushResultObserver. The callback data structure is PushResult.

The callback methodID is kMethodIDPushAddLocalNotificationkMethodIDPushClearLocalNotifications.

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 NameTypeDescription
ActionTypeintSet action type
1: Open activity or app
2: Open browser
3: Open Intent
4: Open app through package name
NotificationIDintSpecifies the notification ID. When a notification with the same ID has already been displayed, the older notification is overwritten.
TitlestringSet message title
ContentstringSet message content
TickerTextstringSet ticker text content
ActionParameterstringWhen 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.
FireTimelongSets the notification trigger time, long type (timestamp in UTC time, units: seconds)
SoundEnabledintWhether to play a sound
0: No
1: Yes
Default: 1
RingRawstringSpecifies the in-app sound (raw/ring.mp3).
For example: android.resource://intlgame.demo/raw/ring
SmallIconstringSpecifies the small status bar icon (test.png)
For example: test
LightsintWhether to light up
0: No
1: Yes
Default: 0
VibrateintWhether to vibrate
0: No
1: Yes
Default: 0

iOS

FINTLLocalNotificationIOS

Member VariableTypeDescription
NotificationIDstring[Required]
Specifies the notification ID.
When a notification with the same ID has already been displayed, the older notification is overwritten.
RepeatTypeintPush resend cycle
1: minutes
2: hours
3: days
4: weeks
5: months
6: years
Default: 0, indicates no resending
FireTimelongLocal push trigger time
BadgeintBadge
AlertBodystringPush content
AlertActionstringReplace popup button text
Default: Enabled
UserInfoList<Dictionary<string,string>> Custom parameter, can be used to identify push notifications and add additional information
AlertTitlestringShort push description