gpt4 book ai didi

android - 使用delphi实现Android 26的通知

转载 作者:行者123 更新时间:2023-11-29 02:21:17 34 4
gpt4 key购买 nike

我使用 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;

最佳答案

看你没 react ,我这边心血来潮,我给你贴上我的通知代码,用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;

关于android - 使用delphi实现Android 26的通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55448224/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com