title: How to start android service from another Android app
body: <p>I'm having a problem starting a service from another Android app (API 17).
  However, if I do run 'am' from the shell, the service starts fine.</p>
  
  <pre><code># am startservice com.xxx.yyy/.SyncService
  Starting service: Intent { act=android.intent.action.MAIN cat=
  [android.intent.category.LAUNCHER] cmp=com.xxx.yyy/.SyncService }
  (service starts fine at this point)
  # am to-intent-uri com.xxx.yyy/.SyncService
  intent:#Intent;action=android.intent.action.MAIN;
  category=android.intent.category.LAUNCHER;
  component=com.xxx.yyy/.SyncService;end
  </code></pre>
  
  <p>So, it doesn't look like I'm missing anything from the intent when I do the same in the code:</p>
  
  <pre><code>Intent i = new Intent();
  i.setAction(Intent.ACTION_MAIN);
  i.addCategory(Intent.CATEGORY_LAUNCHER);
  i.setComponent(new ComponentName("com.xxx.yyy", ".SyncService"));
  ComponentName c = ctx.startService(i);
  if (c == null) { Log.e(TAG, "failed to start with "+i); }
  </code></pre>
  
  <p>What I get is (the service is not running at that time):</p>
  
  <pre><code>E/tag( 4026): failed to start with Intent { 
  act=android.intent.action.MAIN 
  cat=[android.intent.category.LAUNCHER] 
  cmp=com.xxx.yyy/.SyncService }
  </code></pre>
  
  <p>I don't have an intent filter on the service, and I don't want to set one up, I'm really trying to understand what am I doing wrong starting it through its component name, or what may be making it impossible to do so.</p>