So, don't wait and empower your Android apps with background tasks with RAD Studio 10 Seattle, and enjoy many more features and enhancements.

RAD Studio 10 Seattle

No Data
  • Hello Luis Navarro, found it very interesting post, I was able to do following the example of Jim but can not assign simple functions in my service: for example if 12:00 open the application, send a notification, etc. I would like help me? I'm using a LocalService. I thank your attention. implementation {%CLASSGROUP 'FMX.Controls.TControl'} {$R *.dfm} uses Androidapi.JNI.App; function TAndroidServiceDM.AndroidServiceStartCommand(const Sender: TObject; const Intent: JIntent; Flags, StartId: Integer): Integer; begin // Notificar; Timer1.Enabled := True; Result := TJService.JavaClass.START_STICKY; // Keeps service running end; function TAndroidServiceDM.Hora: string; begin Result := FormatDateTime('hh:nn:ss', Now()); end; procedure TAndroidServiceDM.Notificar; var Notificacao : TNotification; begin try Notificacao := NotificationCenter1.CreateNotification; Notificacao.Title := 'Notificar Procedure'; Notificacao.Number := 6; Notificacao.AlertBody := Hora; NotificationCenter1.PresentNotification(Notificacao); finally Notificacao.DisposeOf; end; end; procedure TAndroidServiceDM.Timer1Timer(Sender: TObject); begin Notificar; end; end.
No Data