3

I have an Android IntentService that is behaving strangely. I am sending it an intent via a call to startService(intent).

(I apologize, I'm away from my desk and can't paste any actual code.)

When I make the above call nothing happens. Neither the constructor nor the onHandleIntent methods are called in the Intent Service. There are no compiler warnings or errors and I see nothing of interest in the Console or Log.

As I continue to investigate this, I was just wondering if there is a short list of likely reasons why an IntentService would not start like this with no obvious evidence of why. Is the problem likely in the manifest file?

ColonelPackage
  • 501
  • 1
  • 6
  • 14

1 Answers1

7

I suspect that you need to take a closer look at LogCat. Common problems here include:

  • failed to list the service in the manifest
  • failed to create a public zero-argument constructor on the service (the default constructor for IntentService takes one argument, and you need to add your own constructor)
  • other syntactical problems (e.g., service is declared abstract)

However, all of those will result in messages in LogCat. I can think of no scenario under which startService() would not invoke your code without a message in LogCat.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • You were right. I had a filter enabled and was missing the critical log telling me the class couldn't be found. Turned out to be simple typo in my Manifest file. Thanks for the help! – ColonelPackage Oct 18 '12 at 19:54