stopSelf() vs stopSelf(int) vs stopService(Intention)

Quelle est la différence dans l'appel

stopSelf() , stopSelf(int) ou stopService(new Intent(this,MyServiceClass.class))

à l'intérieur de onStartCommand() ?

par exemple, si je commence à les mêmes services deux fois de cette façon:

...
Intent myIntent1 = new Intent(AndroidAlarmService.this, MyAlarmService.class);
myIntent1.putExtra("test", 1); 
Intent myIntent2 = new Intent(AndroidAlarmService.this, MyAlarmService.class);
myIntent2.putExtra("test", 2);
startService(myIntent1);
startService(myIntent2);
...

Et de mettre en œuvre onStartCommand de cette façon:

public int onStartCommand(Intent intent, int flags, int startId)
{
Toast.makeText(this, "onStartCommand called "+intent.getIntExtra("test", 0), Toast.LENGTH_LONG).show();
stopService(new Intent(this,MyAlarmService.class));
return START_NOT_STICKY;
}

J'ai exactement le même comportement avec les trois méthodes,
c'est onDestroy ne sera appelée après onStartCommand est exécutée deux fois.

InformationsquelleAutor GionJh | 2014-03-18