Service中:
@Deprecated
public void onStart(Intent intent, int startId) {
}
public int onStartCommand(Intent intent, int flags, int
startId) {
onStart(intent, startId);
return mStartCompatibility ?
START_STICKY_COMPATIBILITY : START_STICKY;
}
另外使用startService()方式 onStartCommand()和onStart()方法会执行到。
使用bindService()方式onStartCommand()和onStart()不会执行。