Issue
If my Android app has a running service (e.g. extending a WearableListenerService) does the service always has access to the exact same Application
instance (by using the getApplication
method) as every (maybe later started) Activity
of my app?
Solution
The Application
instance is a singleton. It is created when Android starts any component of your application in a new process.
Note that if Android kills the process hosting your application and then restarts your Service
, it will run in a new process and Android will create a new instance of the Application
class.
Answered By - David Wasser
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.