IntentService is intended for asynchronous use in a workflow. Therefore, there is nothing wrong with calling him several times, if necessary. Tasks will be executed one by one in the thread.
I assume that you have a class derived from IntentService and its onHandleIntent () is overridden. Only improvement I see that you do not need to create two separate intentions - this is basically the same intention with different additions in it. You can distinguish between the two in onHandleIntent ().
So your code should look like this:
while (notification != null) { Intent intent= new Intent(getApplicationContext(),A.class); message = notification.getNotificationMessage(); if (msg1 condition) { intent.putExtra("message1",true); } else { intent.putExtra("message2",true); } startService(intent); //retrieve next notification and delete the current one }
source share