I am trying to catch an Intent from installing a USB device. That is I want to start a Service. But, if the Service is started by other means, I would like to take a different course of action. However, my test to see if the Intent is from installing a USB device is passing even when I think is should not. For example, I can start the Service from a different Android application.
So I'm wondering. Can there be a bunch of Intents waiting to be processed? It would explain why I see my Intent test pass even if I think I didn't do anything to cause it to pass.
I am trying to test for an Intent using Try / Catch code. I dropped extra code that is not related:
try{
Log.d(TAG, "Checking Intent to see if service started due to Intent");
extras = getUSBAccessoryIntentExtras(intent);
Log.d(TAG, "Service started due to Intent");
}
catch(NoUSBIntentFoundException nuife){
Log.d(TAG, "Exception Caught: No intent found error.");
}