title: SecurityException: Not allowed to start service Intent without permission
body: <p>I have a library called com.example.library, containing a service called com.example.library.http.RestService. The library's manifest contains these elements:</p>
  
  <pre><code>&lt;uses-permission android:name="com.example.library.permission.REST_PERMISSION" /&gt;
  
  &lt;permission
      android:name="com.example.library.permission.REST_PERMISSION"
      android:protectionLevel="signature" /&gt;
  
  &lt;application ...&gt;
      &lt;service
          android:name="com.example.library.http.RestService"
          android:enabled="true"
          android:permission="com.example.library.permission.REST_PERMISSION" 
          android:exported="true" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.example.library.LAUNCH_REST_SERVICE" /&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>I'm using that library in an app called com.example.testapp. TestApp's manifest repeats exactly the same elements as the library above. This works fine in the emulator running <strong>4.0.3</strong>, and on a nexus 4 running <strong>4.2.2</strong>, but when I try to use it on an HTC Wildfire S running <strong>2.3.5</strong>, it falls over the moment it tries to launch the service, with the following exception:</p>
  
  <pre><code>java.lang.SecurityException: Not allowed to start service Intent 
  { act=com.example.library.LAUNCH_REST_SERVICE pkg=com.example.testapp (has extras) }
  without permission com.example.library.permission.REST_PERMISSION
  </code></pre>
  
  <p>I'm launching the service with the following code:</p>
  
  <pre><code>Intent intent = new Intent();
  intent.setAction( "com.example.library.LAUNCH_REST_SERVICE" );
  intent.setPackage( "com.example.testapp" );
  
  [setting some extras]
  
  startService( intent );
  </code></pre>
  
  <p>I've been scouring the web for help, and have read every related Stack Overflow question I can find, but just can't find anything I'm missing.</p>