title: How to programmatically check if a service is declared in AndroidManifest.xml?
body: <p>I'm writing a library that provides a Service that is used by other developers by including it in their project. As such, I don't have control over the AndroidManifest.xml. I explain what to do in the docs, but nevertheless a common problem is that people neglect to add the appropriate &lt;service/&gt; tag to their manifest, or add it in the wrong place.</p>
  
  <p>Right now, when my library calls startService while the service isn't declared in the manifest, the only thing that happens is that ActivityManager logs a warning. I would like to throw an exception when this happens so that developers know how to fix it. How can I detect whether the manifest actually declares this Service?</p>