unit UnitNotification;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
System.Notification, FMX.Controls.Presentation, FMX.StdCtrls;
type
TForm1 = class(TForm)
NotificationCenter1: TNotificationCenter;
Button1: TButton;
procedure DoNotification(aName, aTitle, aBody: string);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.DoNotification(aName, aTitle, aBody: string);
var
appNotification: TNotification;
begin
appNotification := NotificationCenter1.CreateNotification;
try
appNotification.Name := aName;
appNotification.Title := aTitle;
appNotification.AlertBody := aBody;
NotificationCenter1.PresentNotification(appNotification);
finally
appNotification.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
DoNotification('Test Name', 'Test Title', 'This is an example');
end;
end.
No comments:
Post a Comment