Solution using SharedPreferences:
As per the documentation, the system calls onHandleIntent(Intent) when the IntentService receives a start request.
So, whenever you add an Intent to your queue, you increment and store an Integer that will represent the number of Intents in queue:
public void addIntent(){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
int numOfIntents = prefs.getInt("numOfIntents", 0);
numOfIntents++;
SharedPreferences.Editor edit = prefs.edit();
edit.putInt("numOfIntents",numOfIntents);
edit.commit();
}
Then, each time onHandleIntent(Intent) is called you decrease that Integer value:
public void removeIntent(){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
int numOfIntents = prefs.getInt("numOfIntents", 0);
numOfIntents--;
SharedPreferences.Editor edit = prefs.edit();
edit.putInt("numOfIntents",numOfIntents);
edit.commit();
}
Finally, whenever you would like to check how many Intents that's in the queue, you simply fetch that value:
public void checkQueue(){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplication());
int numOfIntents = prefs.getInt("numOfIntents",0);
Log.d("debug", numOfIntents);
}