The default implementation of onStartCommand :
public @StartResult int onStartCommand(Intent intent, @StartArgFlags int flags, int startId) { onStart(intent, startId); return mStartCompatibility ? START_STICKY_COMPATIBILITY : START_STICKY; }
mStartCompatibility defined as follows:
mStartCompatibility = getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.ECLAIR;
In version 1.6 Service the onStartCommand implementation onStartCommand not exist onStart . In version 2.1, they made onStart obsolete. Pay attention to the difference in the parameters, flags were introduced there.
Thus, they will maintain compatibility with the old system (PRE Eclair), which expects the old value, and also supports new behavior on newer systems.
source share