Adding more of some of the information of the above answers, which may be useful to others, is that, the startId that the onStartCommand() method gets is different for each startService() call.
Also, if we write a for loop, as mentioned above, the code written in onHandleIntent() will execute as many times as determined by the frequency of the for loop, but sequentially rather than in parallel.
The idea is that the IntentService creates a work queue, and each request to startService() calls onStartCommand() which, in turn, stores the intention in the work queue, and then passes it in turn to onHandleIntent() .
Rahul Gupta Jul 07 '16 at 17:18 2016-07-07 17:18
source share