I have not figured this out myself, but I send an Intent
with:
intent.putExtra("pause", "yes");
startService(intent);
And then I override public int onStartCommand(Intent intent, int a, int b)
inside the IntentService
(which is not recommended) and seeing that "pause" is "yes" I set a static boolean mPaused
to true
. If you have a loop in onHandleIntent
, add && !mPaused
in the loop condition.
Of course this is all 'bad' code and a hack... but I hope somebody else chimes in with the correct way of doing this.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…