The service gets killed after removing the app from recent apps. But this should not be killed and run always on the background. I see that the service is running when the app is open. It's still running when I minimize the app via home-button. But it will stop if I kill it as mentioned above. How do I solve this?
public class NotificationService extends Service {
    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
    @Override
    public void onCreate() {
        Toast.makeText(getApplicationContext(),"service started",Toast.LENGTH_LONG).show();
    }
    @Override
    public void onDestroy() {
        Toast.makeText(getApplicationContext(),"service stopped",Toast.LENGTH_LONG).show();
    }
    @Override
    public int onStartCommand(final Intent intent,
                              final int flags,
                              final int startId) {
        onTaskRemoved(intent);
        //code
        return  START_STICKY;
    }
    @Override
    public void onTaskRemoved(Intent rootIntent) {
        Intent myIntent = new Intent(getApplicationContext(), NotificationService.class);
        myIntent.setPackage(getPackageName());
        startService(myIntent);
        super.onTaskRemoved(rootIntent);
    }
}
I don't want any notification for service as in case of foreground service.