AW: Notifications mit individuellem Sound
Zitat:
Unter Android ist MP3 auch kein Problem, ich habe viele eigene kleine MP3s auf meinem Handy und als Ping für SMS, WhatsApp, Mail.....name it, you got it....eingestellt. |
AW: Notifications mit individuellem Sound
Zitat:
|
AW: Notifications mit individuellem Sound
Anzeige ist raus ... ach Quatsch, ich meine Ticket ist eröffnet. 8-)
|
AW: Notifications mit individuellem Sound
UPDATE:
Habe meine Anwendung mal wieder für Windows kompiliert und auch hier kommt die Notification (unten rechts am Bildschirm), aber auch nicht mit meinem Ton, sondern das Standard-Palimpalim. |
AW: Notifications mit individuellem Sound
Zitat:
Dann können wir es ggf. verfolgen, kommentieren (falls uns noch was hilfreiches dazu einfällt) usw... |
AW: Notifications mit individuellem Sound
Zitat:
https://embt.atlassian.net/servicede...rtal/1/RSS-887 |
AW: Notifications mit individuellem Sound
Sorry, ich hatte vergessen, meine Lösung hier zu posten.
Man muss das über einen Channel machen. Ich hatte dazu ein Ticket im Customer Support Portal eröffnet. Die Antwort: Zitat:
Delphi-Quellcode:
{$ifdef ANDROID}
const sChannelID = 'MyChannelID'; // to have a custom sound you HAVE to use custom channel // as the channel's sound is set at creation //this is crucial bit... // to use fileprovider you need to specify secure file sharing in the entitlements list function GetFileUriStr(const AFileName: string): string; var LFile: JFile; begin LFile := TJFile.JavaClass.init(StringToJString(AFileName)); Result := JStringToString(TAndroidHelper.JFileToJURI(LFile).toString); end; {$endif} procedure TdmNotification.CreateDefaultNotificationChannel; // wird vorab aufgerufen, z.B. im Create var NotificationChannel: TChannel; begin NotificationChannel := NotificationCenter.CreateChannel; NotificationChannel.Id := sChannelID; NotificationChannel.Title := 'Custom notification channel'; NotificationChannel.Description := 'Notification channel to test sound'; NotificationChannel.Importance := TImportance.High; // NOTE: This is a 'heads-up notification'. //the CONTENT URI string needs to be set here and will be used for the all THIS channel notifications NotificationChannel.SoundName:= GetFileUriStr(GetSoundFileName); NotificationCenter.CreateOrUpdateChannel(NotificationChannel); end; function TdmNotification.GetSoundFileName: string; begin {$IFDEF IOS} Result := 'mixkit-bell-notification-933.caf'; {$ELSE} Result := IncludeTrailingPathDelimiter(TPath.GetDocumentsPath) + 'mixkit-bell-notification-933.mp3'; {$ENDIF} end; procedure TdmNotification.CreateNotification(AlarmTime); var Notification: TNotification; begin Notification := NotificationCenter.CreateNotification; try Notification.Name :='MyNotification'; Notification.Title :='Test Notification Title'; Notification.AlertBody:='Test Notification with individual sound'; {$ifdef ANDROID} Notification.ChannelId := sChannelID; {$else} Notification.EnableSound:=true; Notification.SoundName:= GetSoundFileName; {$endif} Notification.FireDate:= AlarmTime; NotificationCenter.ScheduleNotification(Notification); finally Notification.Free; end; end; |
AW: Notifications mit individuellem Sound
Wenn man schon TPath benutzt, dann kann man auch gleich Weiteres davon verwenden.
Delphi-Quellcode:
Result := IncludeTrailingPathDelimiter(TPath.GetDocumentsPath) + 'mixkit-bell-notification-933.mp3';
Result := TPath.Combine(TPath.GetDocumentsPath, 'mixkit-bell-notification-933.mp3'); |
AW: Notifications mit individuellem Sound
@bcvs
Das wäre eigentlich genau das Beispiel, wonach ich gesucht habe, da gibts echt nicht viel, aber leider bekomme ich in der Zeile
Code:
der Prozedur CreateDefaultNotificationChannel die Fehlermeldung, dass es die Funktion im Objekt TChannel nicht gibt.
NotificationChannel.SoundName:= GetFileUriStr(TPath.Combine(TPath.GetDocumentsPath, 'bell.mp3'));
Kommentiere ich diese Zeile aus, lässt sich die App natürlich kompilieren, löst aber nicht das Problem. Und für Windows wird es gar nicht gelöst, da ja einige Funktionen / Befehle eh nur unter Android verfügbar sind. Und nu? Liegt es vielleicht daran, dass ich Delphi 11 CE verwende und nicht die Vollversion 12? |
AW: Notifications mit individuellem Sound
Was gibt es bei dir nicht? Das Feld Soundname? Würde mich schon sehr wundern.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:50 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz