In an android app, can I just use the application context instead of a service service? -
i made app uses application context share data , run functions between activities (or when activity closed). have broadcastreceiver
processes intents, plus spawns new threads run common functions stored in app context. since activities , broadcast receiver can access app context calling this.getapplicationcontext()
, seems easier way run stuff in background while sharing data , functions throughout app.
but have few questions: there downside doing way? why want create service if works flawlessly? (and far, has) there larger battery drain doing way vs. service?
i think there no right answer. if broadcastreceiver mechanism working fine, go it. there no need service. better have broadcastreceiver have service may idle long time waiting upon event/action. 2 cents.
Comments
Post a Comment