Enhance IntentServices - PerfectCarl/androidannotations GitHub Wiki
Since AndroidAnnotations 3.0
You can enhance an Android IntentService with the @EIntentService
annotation to simply handle actions in @ServiceAction
annotated methods.
As for @EService
, you can then start using most AA annotations, except the ones related to views and extras.
@EIntentService
public class MyIntentService extends IntentService {
@ServiceAction
void mySimpleAction() {
// ...
}
@ServiceAction
void myAction(String param) {
// ...
}
@Override
protected void onHandleIntent(Intent intent) {
// Do nothing here
}
}
You can start an enhances activity via the inner Builder :
MyIntentService.intent(getApplication()) //
.myAction("test") //
.start();