ForegroundService can’t start – FMX

  

On newer version android I’m change startService to startForegroundService but service can’t start.In manifest file is added ForegroundService permission.
LIntent := TJIntent.Create;
LIntent.setClassName(TAndroidHelper.Activity.getBaseContext, TAndroidHelper.StringToJString(‘myService’));
TAndroidHelper.Activity.startForegroundService(LIntent);

On android 5 work fine:
LIntent := TJIntent.Create;
LIntent.setClassName(TAndroidHelper.Activity.getBaseContext, TAndroidHelper.StringToJString(‘com.embarcadero.services.myService’));
TAndroidHelper.Activity.startService(LIntent);

Comments are closed.