title: Android: Start Service on boot?
body: <p>I'm reaaaaally new to Java, but an experienced C#-coder.</p>
  
  <p>I've created a service which I can start/stop from an activity.
  My question is, how do I "install" this service so it does start upon boot of my device?</p>
  
  <p>I found this:</p>
  
  <p><a href="https://stackoverflow.com/questions/2784441/trying-to-start-a-service-on-boot-on-android/5439320#5439320">Trying to start a service on boot on Android</a></p>
  
  <p>I've tried to implemented this like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="james.jamesspackage" android:versionCode="1"
  android:versionName="1.0"&gt;
  &lt;uses-sdk android:minSdkVersion="7" /&gt;
  
  &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;
  &lt;application android:icon="@drawable/icon" android:label="@string/app_name"
      android:debuggable="true"&gt;
      &lt;activity android:name=".jamessActivity" android:label="@string/app_name"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;service android:enabled="true" android:name=".MyService"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="james.jamesspackage.MyService" /&gt;
          &lt;/intent-filter&gt;
          &lt;/service&gt;
      &lt;receiver android:name="james.jamesspackage.MyBroadcastReceiver"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
              &lt;category android:name="android.intent.category.HOME" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>What's wrong? Can I have an activity and a service/receiver in one manifest?</p>
  
  <p>Thanks</p>
  
  <p>James</p>