tags:

views:

374

answers:

1

I am studying RemoteService example in Android's APISample. In the manifest file, it declares the service like this: My question is how can I specify the service to be 'auto-start', i.e. it gets start whenever the phone start?

   <service android:name=".app.RemoteService" android:process=":remote" >
       <intent-filter>
           <!-- These are the interfaces supported by the service, which
                you can bind to. -->
           <action

android:name="com.example.android.apis.app.IRemoteService" />

Thank you.

+3  A: 

First, you do not want to do that.

Second, you cannot do that directly. You will need to set up a BroadcastReceiver to watch for the BOOT_COMPLETED broadcast Intent, and have that receiver start the service.

CommonsWare