Show Notification in System Bar:

Show Notification in System Bar:


uses
  FMX.Notification;

var
  FNotificationCenter: FMX.Notification.TNotificationCenter;

...
FNotificationCenter := FMX.Notification.TNotificationCenter.Create(Application);
...
procedure TTabbedForm.Button1Click(Sender: TObject);
var
  LNotification: TNotification;
begin
  LNotification := FNotificationCenter.CreateNotification;
  try
    LNotification.Name := 'TestNotification';
    LNotification.AlertBody := 'AlertBody';
    LNotification.AlertAction := 'AlertAction';
    LNotification.Number := 1;
    LNotification.FireDate := IncSecond(Now, 5);
    LNotification.HasAction := False;

    FNotificationCenter.PresentNotification(LNotification);

  finally
    LNotification.Free;
  end;
end;


:)
#android   #delphixe5   #xe5   #fmx

Comments

  1. Excellent, thanks!

    Do you maybe know what event needs to be hooked so the program can do something when user clicks on this notification?

    ReplyDelete
  2. To answer myself: FNotificationCenter.OnReceiveLocalNotification

    ReplyDelete
  3. nice :)
    Sorry, had no time to check....

    ReplyDelete

Post a Comment