Jump to content

MirDurmaz

Members
  • Content Count

    5
  • Joined

  • Last visited

Everything posted by MirDurmaz

  1. MirDurmaz

    Ios Notification Error

    I need to help about Firebase Notification service using Delphi Fmx. I created a acount in Google FireBase. I achieved Android Notification in Delphi Fmx. I created p8 file in MAc OX and add Firebase. Project Options Verion Info changed CFBundleIdentifier same bundle at Firebase My code: unit uMain; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Memo.Types, FMX.Controls.Presentation, FMX.ScrollBox, FMX.Memo , System.IOUtils, System.PushNotification {$IFDEF ANDROID}, FMX.PushNotification.Android {$ENDIF} {$IFDEF IOS} ,FMX.PushNotification.IOS ,FMX.PushNotification.FCM.iOS {$ENDIF} ; type TfrmMain = class(TForm) edt: TMemo; procedure FormCreate(Sender: TObject); private { Private declarations } FDeviceId : String; FDevicetoken : String; FPushService: TPushService; FPushServiceConnection: TPushServiceConnection; procedure OnServiceConnectionChange(Sender: TObject; PushChanges: TPushService.TChanges); procedure OnReceiveNotificationEvent(Sender: TObject; const ServiceNotification: TPushServiceNotification); public { Public declarations } end; var frmMain: TfrmMain; implementation {$R *.fmx} procedure TfrmMain.FormCreate(Sender: TObject); var PushService: TPushService; ServiceConnection: TPushServiceConnection; Notifications: TArray<TPushServiceNotification>; begin PushService := TPushServiceManager.Instance.GetServiceByName(TPushService.TServiceNames.FCM); ServiceConnection := TPushServiceConnection.Create(PushService); ServiceConnection.OnChange := OnServiceConnectionChange; ServiceConnection.OnReceiveNotification := OnReceiveNotificationEvent; ServiceConnection.Active := True; FDeviceId :=PushService.DeviceIDValue[TPushService.TDeviceIDNames.DeviceId]; edt.Lines.Add('DeviceID: ' + FDeviceId); edt.Lines.Add('Ready to receive!'); Notifications := PushService.StartupNotifications; if Length(Notifications) > 0 then begin edt.Lines.Add('-----------------------------------------'); edt.Lines.Add('DataKey = ' + Notifications[0].DataKey); edt.Lines.Add('Json = ' + Notifications[0].Json.ToString); edt.Lines.Add('DataObject = ' + Notifications[0].DataObject.ToString); edt.Lines.Add('-----------------------------------------'); end; end; ServiceConnection.Active := True; give me error Acess Violatin I colud to need to your recommend
  2. MirDurmaz

    Ios Notification Error

    Fisrtly I want to thanks a lot for your answer. Yes we set on the Apple Developer website a Push Notification.
  3. MirDurmaz

    Ios Notification Error

    I suceesded to get deviceId but take the Token give me error: A valid "aps-enviroment" authorization key was not found for the application
  4. MirDurmaz

    Json create Array

    Hi EverBody, I have a problem a create json.I don't create a json array without name property. I could create below json: { "registration_ids" : [ "crX7c-FfQXunMB5dqoaaUM:APA91brRYBuOESgGzWKmLg0M" ], "notification" : { "title": "Hi", "body" : "Notification test" } } My delphi code: wrtString := TStringWriter.Create(); wrtJSON := TJsonTextWriter.Create(wrtString); try wrtJSON.Formatting := TJsonFormatting.Indented; wrtJson.WriteStartObject; wrtJson.WritePropertyName('registration_ids'); wrtJson.WriteStartArray; wrtJson.WriteStartObject; wrtJson.WritePropertyName(''); wrtJson.WriteValue(strToken); wrtJson.WriteEndObject; wrtJson.WriteEndArray; wrtJson.WritePropertyName('notification'); wrtJSON.WriteStartObject; wrtJSon.WritePropertyName('title'); wrtJson.WriteValue(edtBaslik.Text); wrtJson.WritePropertyName('body'); wrtJson.WriteValue(edtMesaj.Text); wrtJSON.WriteEndObject; wrtJSON.WriteEndObject; and my json: { "registration_ids": [ { "": "crX7c-FfQXunMB5dqoaaUM:APA91bHOuvOioxEjciJS9V04g9" ], "notification": { "title": "Hello", "body": "Delphi" } }
  5. MirDurmaz

    Json create Array

    Thanks a lots
×