I am developing an android app which does a long running task either invoked by user or scheduled by Alarm.
I have designed it in Activity - > Service - > AsyncTask form of invocation.
I use the Otto library to bring UI updates directly from the AsyncTask to the activity.
I have two question:
1 Is there a reason I should use Otto to do the communication from AsyncTask - > Service and then from Service - > Activity. I have seen lots of apps use this pattern.
2 When should I run the service in foreground ? The argument of not being killed by low memory can be abused. I want to make a conscious decision. I believe it should run in foreground when invoked by user manually and not when kicked by Alarm.