How to isolate a library service from different applications
<p>I have a service in a library project:</p>

<pre><code>package com.example.project;
class MyService extends Service;
</code></pre>

<p>When I add it to an app, I include the service tag in the app manifest:         </p>

<pre><code>&lt;manifest package="com.example.project.myapp1"...
    &lt;application...
        &lt;service
            android:name="com.example.project.MyService"
            android:exported="false" &gt;            
            &lt;intent-filter&gt;
                &lt;action android:name=".MYINTENT" /&gt;
            &lt;/intent-filter&gt;
        &lt;/service&gt;
</code></pre>

<p>I send commands to the service using startService, I'm not binding to the service because I need the service to keep running even after the activity is destroyed and not binding was much simpler. And it works fine. </p>

<p>So I create another app using the same library and service:</p>

<pre><code>&lt;manifest package="com.example.project.myapp2"...
    &lt;application...
        &lt;service
            android:name="com.example.project.MyService"
            android:exported="false" &gt;            
            &lt;intent-filter&gt;
                &lt;action android:name=".MYINTENT" /&gt;
            &lt;/intent-filter&gt;
        &lt;/service&gt;
</code></pre>

<p>I can't change the service name, because the service class is the same, right?</p>

<p>The problem is that this second app tries to call the service from the first app instead of its own service.</p>

<p>So how can I isolate services implemented using the same class but running in different apps?</p>
