簡體   English   中英

在帶有delphi-XE6的Mac OSX上顯示通知

[英]Showing Notifiction on Mac OSX with delphi-XE6

當我為Mac OSX創建通知時。 我可以設置通知的(唯一)名稱,但標題不變。 它僅顯示應用程序的名稱。

procedure TPWTrayIcon.MacNotification(pTitle, pMessage: string);
var
 Note       : TNOtification;
 NoteCenter : TNotificationCenter;
begin
  NoteCenter:=TNotificationCenter.Create(nil);
  try
    note := NoteCenter.CreateNotification(pTitle,pMessage,Now+EncodeTime(0,0,1,0));
    try
    note.AlertAction := 'Alert';
//    note.name := pTitle;
//    note.AlertBody := pMessage;
//    note.FireDate  := Now + EncodeTime(0, 0, 1, 0);
    NoteCenter.ScheduleNotification(note);
    finally
      note.DisposeOf;
    end
  finally
    NoteCenter.Free;
  end;

通知事項

如您所見,通知的名稱是應用程序名稱,無法通過當前API對其進行更改。 無論如何,由於它獲得了應用程序名稱,因此您可以嘗試作為一種變通辦法(一種hack)在運行時根據需要更改應用程序名稱。

如果無法在FMX中更改應用程序名稱,那么恐怕目前無法更改通知的標題。

但是,Mac OS X中的通知標題曾經是推送它的應用程序名稱,因此我認為Mac OS X規范中定義了這種方式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM