Reputation: 259
If you provide an extended Application class, will onCreate be called when a Service is created, even if no Activity is brought to the foreground?
Upvotes: 3
Views: 1314
Reputation: 8132
Application.onCreate is called before anything in your package is instantiated.
From the documentation:
Called when the application is starting, before any other application objects have been created. Implementations should be as quick as possible (for example using lazy initialization of state) since the time spent in this function directly impacts the performance of starting the first activity, service, or receiver in a process.
Upvotes: 3