android service and broadcast receiver questions
<p>Hello I have an activity that binds to a service and registers some callback methods.</p>

<p>I would like for the activity to run for as long as the phone is on, the activity will bind register callbacks and unbind from time to time.</p>

<p>Also I've got a broadcast receiver that starts the service on boot and another that checks in regular times if the service is running and if not starts it.</p>

<p>My first problem is that only when the activity binds and start the service the service runs propertly, the code for starting that from the activity is as follows:</p>

<pre><code>bindService(new Intent(IMonitorService.class.getName()),
                Iconn, 0);

        //start Monitor service.
        Intent serviceIntent = new Intent(contxt,MonitorService.class);
        contxt.startService(serviceIntent);
</code></pre>

<p>firstly,isn't it enough to just bind to the service? that ensures that the service will start if its not running right?</p>

<p>also the code for the broadcast receiver is this:</p>

<pre><code>//start Monitor service.
        Intent serviceIntent = new Intent(context,MonitorService.class);
        context.startService(serviceIntent);
</code></pre>

<p>since I just want to start the service and let it run.</p>

<p>my manifest is:</p>

<p>for the receiver:</p>

<pre><code>&lt;receiver android:name=".BootReceiver"&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;
</code></pre>

<p>for the service :</p>

<pre><code>&lt;service android:name=".MonitorService"
        android:process=":remote"&gt;
        &lt;intent-filter&gt;
            &lt;!--
                These are the interfaces supported by the service, which you can
                bind to.
            --&gt;
            &lt;action android:name="sap.max.IMonitorService" /&gt;
            &lt;!--
                This is an action code you can use to select the service without
                explicitly supplying the implementation class.
            --&gt;
            &lt;action android:name="sap.max.AntiTheft.Monitor" /&gt;
        &lt;/intent-filter&gt;
    &lt;/service&gt;
</code></pre>

<p>Note that the service is running under its own process.</p>

<p>Using the above mentioned receiver the service is never run, it starts but it's onStart method is never called.</p>

<p>also for the alarm service in the main activity I do this :</p>

<pre><code>Intent intent = new Intent(AntiTheft.this, LiveCheckerReceiver.class);
    PendingIntent sender = PendingIntent.getBroadcast(this, 1234567, intent, 0);
</code></pre>

<p>and I've got this on my manifest:</p>

<pre><code>&lt;receiver android:name="LiveCheckerReceiver" 
        android:process=":remote" /&gt;
</code></pre>

<p>but this never works as well.</p>

<p>some final questions, if the service calls a callback method and the activity isn't bind it will throw a bind exception correct?</p>

<p>also how to test if my service is alive and running?</p>

<p>sorry for all those questions,regards maxsap</p>
