When creating notification using TNotificationCenter
and TNotification
, it only appear in the notification drawer, it won't have pop up mini floating box like WhatsApp msg notification for examples. Is there any properties that will enable that?
CodePudding user response:
You need to create a channel with an importance of High, and have the notifications sent using the id for that channel (via the ChannelId property of the notification). Example code for setting up the channel:
procedure TForm1.SetupNotificationChannel;
var
LChannel: TChannel;
begin
LChannel := NotificationCenter.CreateChannel;
try
LChannel.Id := 'MyChannel';
LChannel.Title := LChannel.Id;
LChannel.Importance := TImportance.High;
NotificationCenter.CreateOrUpdateChannel(LChannel);
finally
LChannel.Free;
end;
end;
NotificationCenter
is a TNotificationCenter
component