我使用Delphi 10.1来开发android应用程序,并且我已经使用Delphi sample来实现Android 26 API,当我使用通知时,它不会显示。我也尝试过使用Notification example。但这是行不通的。请帮助我实施该通知,因为我需要从Android服务中实施此通知。
procedure TForm1.ImmediateNotification;
var
LNotification: TNotification;
begin
LNotification.EnableSound := False;
LNotification.Title := 'Immediate Notification';
LNotification.Subtitle := 'Subtitles are cool';
LNotification.AlertBody := 'This is an immediate notification';
FNotifications.PresentNotification(LNotification);
end;
答案 0 :(得分:0)
看到您没有反应,我在这里一时兴起,我为您准备了通知代码,要使用Android Service实施通知代码,您应该查看:This from the DocWiki >
procedure TF_SS_MAIN.NotifyAndroid(text: string);
var
Notification: TNotification;
begin
{verify if the service is actually supported}
if NotificationCenter1.Supported then
begin
Notification := NotificationCenter1.CreateNotification;
Notification.Name := 'Notif Name';
Notification.AlertBody := text;
Notification.FireDate := Now;
{Send notification in Notification Center}
NotificationCenter1.ScheduleNotification(Notification);
end;
end;