It was working fine up to Oreo but after the API 28 PIE VERSION released the background service is not working properly, the exact flow is after starting the service without stopping it manually, the service automatically is being stopped when the app is killed. Can anyone tell me how to do it.
public void stopLocationService() {
Log.d(TAG, "stopLocationService: ");
Intent i = new Intent(getApplicationContext(), LocationService.class);
stopService(i);
}
public void startLocationService() {
Log.d(TAG, "startLocationService: ");
Intent intent = new Intent(getApplicationContext(), LocationService.class);
startService(intent);
}