I'm doing some tests with services. My code in local service is just:
function TDM.AndroidServiceStartCommand(const Sender: TObject;
const Intent: JIntent; Flags, StartId: Integer): Integer;
begin
Result := TJService.JavaClass.START_STICKY;
my_log('Service started');
end;
But service doesn't restart when I close the app. I know that a local service runs in the same process as the app so it is normal the service finish, but START_STICKY should start the service automatically but this is not happening. The service only starts automatically when I open the application again. Is this a Delphi issue? In applications made in Java the service starts correctly.
I'm running on Android 10.
try to check battery settings for your app (just to be sure that you have not restricted run of background service)