Skip to content

Instantly share code, notes, and snippets.

@DelphiWorlds
Created June 7, 2022 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DelphiWorlds/280d5b4af8b76bfb5f9e956ef17ab67f to your computer and use it in GitHub Desktop.
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
// 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