Einzelnen Beitrag anzeigen

Kai_in_HH

Registriert seit: 25. Jun 2008
Ort: Hamburg
57 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: Notifications mit individuellem Sound

  Alt 9. Mai 2024, 21:26
Verdammte Axt, ich habe das gleiche Problem.

Ich stelle in assets\internal\ meine eigene mp3 bereit, sie wird aber nicht als Notification-Ton verwendet. Es kommt immer nur der Standard-Ton.

Hier mein Code
Code:
procedure TForm1.PresentNotificationClick(Sender: TObject);
var
  MyNotification: TNotification;
begin
  MyNotification := NotificationCenter1.CreateNotification;
  try
    MyNotification.Name := 'BikeAppNotification';
    MyNotification.AlertBody := 'BikeApp Notification';
    MyNotification.FireDate := Now;
    MyNotification.EnableSound := True;
    MyNotification.SoundName := TPath.Combine(ProgDir, 'bell.mp3');;
    NotificationCenter1.PresentNotification(MyNotification);
  finally
    MyNotification.DisposeOf;
  end;
end;
ProgDir wird in einer anderen Funktion so ermittelt und funktioniert z.B. auch einwandfrei für die Arbeit mit meiner SQLLite-DB, daran kanns also nicht liegen

Code:
 ProgDir := TPath.GetDocumentsPath;
Also das ist nach allen Anleitungen eigentlich der richtige Weg. Interessiert nur meine App (oder den Delphi-Compiler?) nicht.

Kai
Kai
formerly known as linus_wildcat
  Mit Zitat antworten Zitat