How can we prevent a Service from being killed by Android

    @Override
    public void onDestroy() {

        super.onDestroy();

        Intent forceIntent=new Intent("net.pupli.monitoring.action.ForceRestart");
        sendBroadcast(forceIntent);
    }

    @Override
    public void onTaskRemoved(Intent rootIntent) {

        super.onTaskRemoved(rootIntent);

        Intent forceIntent=new Intent("net.pupli.monitoring.action.ForceRestart");
        sendBroadcast(forceIntent);
    }
public class ForceRestartReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        try {
            Intent forceIntent = new Intent(context, MonitoringService.class);
            context.startService(forceIntent);
        } catch (Exception ex) {
            ex.printStackTrace();
            MyLog.ex(ex);
        }

    }
}
        <receiver
            android:name=".ForceRestartReceiver">
            <intent-filter>
                <action android:name="net.pupli.monitoring.action.ForceRestart" />
            </intent-filter>
        </receiver>

References
https://stackoverflow.com/questions/9696861/how-can-we-prevent-a-service-from-being-killed-by-os
https://stackoverflow.com/questions/8537630/trouble-broadcasting-an-intent-to-android-service-from-application-class
https://stackoverflow.com/questions/30525784/android-keep-service-running-when-app-is-killed