lundi 18 mai 2015

Starting Service in Android calls Applications onCreate

I am starting an android service using,

startService(getApplicationContext(), MyService.class);

I have correctly defined my service in AndroidManifest. Now, I am calling above code from Application create.

Case 1: Calling above code from Application onCreate()

  • I see that Application.onCreate() gets called two time. One is the desired App create and other happens when startService is called.

Case 2: Calling above code from Activity in application

  • Same behavior as case 1.

Is this intended behavior?

Aucun commentaire:

Enregistrer un commentaire