I know that is possible to start a service with no activities, … My question is: if I start the service as Foreground (calling startForegorund()), is the application object always instantiated?
Or is it possible that getApplication() == null in some cases?
I’d say
Applicationis created whenever your app is running regardless if it’s activity, foreground or background service. So you shouldn’t getnullwhen callgetApplication.