0

I want to create a channel to receive push notifications from Firebase on Android. I added in project/options/application/Services/Default notifications channel id "MyChannel" and implemented the code below that I found in this question Delphi 10.4.2 FMX How to make a head up notification? to-make-a-head-up-notification/70517137#70517137.

For testing I'm using a device with android 8.1.0, API 26, notifications are normally received by the device, but when I run the code the app crashes (freezes the screen). what can be wrong?

procedure TForm1.SetupNotificationChannel;
var
    LChannel: TChannel;
begin
    LChannel := NotificationCenter.CreateChannel;
    try
        LChannel.Id := 'MyChannel';
        LChannel.Title := LChannel.Id;
        LChannel.Importance := TImportance.High;
        NotificationCenter.CreateOrUpdateChannel(LChannel);
    finally
        LChannel.Free;
    end;
end; 

0 Answers0