Created
June 7, 2022 08:16
-
-
Save DelphiWorlds/280d5b4af8b76bfb5f9e956ef17ab67f to your computer and use it in GitHub Desktop.
A fix for the banner not showing for the SendCancelNotification demo for Delphi 11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original demo is at: | |
// https://github.com/Embarcadero/RADStudio11Demos/tree/main/Object%20Pascal/Mobile%20Snippets/Notifications/SendCancelNotification | |
// Code to add to the implementation section. Use code completion to add it to the interface section: | |
const | |
cNotificationChannelId = 'NotificationsDemo'; | |
constructor TNotificationsForm.Create(AOwner: TComponent); | |
begin | |
inherited; | |
CreateChannel; | |
end; | |
procedure TNotificationsForm.CreateChannel; | |
var | |
LChannel: TChannel; | |
begin | |
LChannel := TChannel.Create; | |
try | |
LChannel.Id := cNotificationChannelId; | |
LChannel.Title := 'Demo of notifications'; | |
LChannel.Description := ''; | |
LChannel.Importance := TImportance.High; | |
NotificationC.CreateOrUpdateChannel(LChannel); | |
finally | |
LChannel.Free; | |
end; | |
end; | |
// Then modify ActionSendScheduledNotificationExecute and ActionSendNotificationImmediatelyExecute to set the | |
// ChannelId property of the notification e.g: | |
Notification.ChannelId := cNotificationChannelId; | |
// NOTE: **** This does NOT solve the non-appearance of the banner for notifications when the app is in the foreground **** | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment