title: Conditionally declare service in AndroidManifest
body: <p>I have a service, in particular an Android Daydream <code>DreamService</code>, that I have declared in my <code>AndroidManifest.xml</code> file. When my app is loaded, Android detects this declaration and adds my app as an option to the list of Daydreams the user can choose from in their Settings. I am declaring this <code>Service</code> as follows...</p>
  
  <pre><code>&lt;service android:name=".daydream.DaydreamService" android:exported="true"
          android:icon="@drawable/icon" android:label="@string/app_name" &gt;
     &lt;intent-filter&gt;
          &lt;action android:name="android.service.dreams.DreamService" /&gt;
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
     &lt;/intent-filter&gt;
  
     &lt;meta-data
          android:name="android.service.dream"
          android:resource="@xml/daydream" /&gt;
  
  &lt;/service&gt;
  </code></pre>
  
  <p>I'm trying to see if there is a way I can conditionally load this <code>Service</code> declaration programmatically. In other words, I want to only <em>declare</em> this <code>DreamService</code> based on some programmatic logic. I don't want Android to list or even be aware of my app's Daydream feature unless I programmatically enable it.</p>
  
  <p><strong>Is something like this possible?</strong></p>