Skip to main content

Add or clear local notifications (AddLocalNotification/ClearLocalNotifications)

AndroidiOS
If you are using the Unity engine, please refer to AddLocalNotification in the Unity SDK.
caution

For Android platform, you need to enable the ANDROID_LOCAL_NOTIFICATION_ENABLE configuration in INTLConfig.ini.

Local notifications are set by the user, stored locally, and triggered by time.

If the set time is less than the current device time, the notification will pop up immediately.

info

Android and iOS message structures are different.

Function definition

// Add Local Notification for Android
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool AddLocalNotification(const FString Channel, const FINTLLocalNotification LocalNotification);

// Add Local Notification for iOS
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool AddLocalNotificationIOS(const FString Channel, const FINTLLocalNotificationIOS localNotification);

// Clear Local Notifications
UFUNCTION(BlueprintCallable, Category = "INTLSDKAPI")
static bool ClearLocalNotifications(const FString Channel);

Parameter description

AddLocalNotification

ParametersTypeExplanation
ChannelFStringChannel definition
e.g., "Firebase"
LocalNotificationFINTLLocalNotificationLocal message structure

AddLocalNotificationIOS

NameParameter TypeExplanation
ChannelFStringChannel definition
e.g., "Firebase"
LocalNotificationFINTLLocalNotificationIOSLocal message structure

Callback Handling

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

The callback ID is kMethodIDPushAddLocalNotification, kMethodIDPushClearLocalNotifications.

Code Example

FINTL Local Notification message;
UINTLSDKAPI::AddLocalNotification("Firebase", message);
FINTL Local Notification iOS message;
UINTLSDKAPI::AddLocalNotificationIOS("Firebase", message);

Data Structure

Android

FINTLLocalNotification

Member Variable NameTypeExplanation
ActionTypeintSet action type:
1: Open activity or the app itself
2: Open the browser
3: Open Intent
4: Open application via package name
NotificationIDintSpecify the notification ID; notifications with the same ID that have already been displayed will be overwritten by subsequent ones.
TitleStringSet message title
ContentstringSet message content
TickerTextStringSet ticker text content
ActionParameterStringWhen ActionType=1, ActionParameter can be the class name of an Activity within the app.e.g., com.intl.TestActivity.
When ActionType=2, ActionParameter is a URL that will be opened directly in the browser upon notification click.
When ActionType=3, ActionParameter is a serialized Intent.
When ActionType=4, ActionParameter is the application's package name.
FireTimelongSet the time to trigger the notification, of type long (UTC timestamp, unit: seconds).
SoundEnabledintEnable sound playback
0: No, 1: Yes
Default: 1
RingRawStringSpecify the sound in the application (raw/ring.mp3),
e.g.: android.resource://intlgame.demo/raw/ring
SmallIconStringSpecify the small icon for the status bar (test.png)
e.g.: test
LightsintEnable breathing light
0: No, 1: Yes
Default: 0
VibrateintEnable vibration
0: No, 1: Yes
Default: 0

iOS

FINTLLocalNotificationIOS

Member VariablesTypeExplanation
NotificationIDString[Required]
Specify the notification ID
Notifications with the same displayed ID will be overridden by the latter.
RepeatTypeintPush repeat interval
1: Minute
2: Hour
3: Day
4: Week
5: Month
6: Year
Default: 0, meaning no repeat
FireTimelongTime to trigger the local notification
BadgeintBadge
AlertBodyStringContent of the push
AlertActionStringReplace the button text in the popup
Default: Launch
UserInfoList<Dictionary<string,string>>Custom parameters, can be used to identify the push and add additional information
AlertTitleStringShort description of the push