RenSword
RenSword

Reputation: 99

Delphi 10.4.2 FMX How to make a head up notification?

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?

Upvotes: 2

Views: 1093

Answers (1)

Dave Nottage
Dave Nottage

Reputation: 3612

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

Upvotes: 4

Related Questions