简体   繁体   中英

Showing Notifiction on Mac OSX with delphi-XE6

When i create a Notification for mac OSX. I can set the (unique)name of the notication, but the Title doesn't change. It just shows the name of the application.

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;

通知事项

As you noticed the name of the notification is the application name and there is no way to change it through the current API. Anyway since it gets the application name you could try as a Workaround(a sort of hack) to change the application name at runtime as needed.

If changing the application name in FMX is not possible it I'm afraid that there is no way at the moment to change the Title of the notification.

However the notification Title in Mac OS X is ever the application name that have pushed it,so I think is in this way defined in the Mac OS X spec.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM