4

Following this question, I've a doubt.

Let's say in my applicaiton I've defined 2 intent services that automatically starts after boot, i.e.

<application>
    <receiver android:name=".InterntService1" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />

            <category android:name="android.intent.category.HOME" />
        </intent-filter>
    </receiver>
    <receiver android:name=".InterntService2" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />

            <category android:name="android.intent.category.HOME" />
        </intent-filter>
    </receiver>
</application>

Now, does that mean that IntentSerive2 will only be executed after IntentSerivce1 has been finished?

Or both service1 & 2 can be executed parallely?

Community
  • 1
  • 1
adam black
  • 607
  • 5
  • 14

1 Answers1

2

The manifest you've posted contains entries for 2 BroadcastReceivers, not 2 Services. On boot, Android will call the onReceive() method of each of these BroadcastReceivers. Since the onReceive() method runs on the main thread, it is not possible for both of these to be called in parallel, so one will be called and then the other will be called. The order of the calls to onReceive() is not defined (as far as I know).

David Wasser
  • 93,459
  • 16
  • 209
  • 274