forked from androidannotations/androidannotations
-
Notifications
You must be signed in to change notification settings - Fork 0
Enhance IntentServices
WonderCsabo edited this page Nov 21, 2014
·
3 revisions
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 enhanced IntentService via the inner Builder :
MyIntentService.intent(getApplication()) //
.myAction("test") //
.start();
Since AndroidAnnotations 3.3
Note: Since IntentService#onHandleIntent
is abstract, you have to add an empty implementation. For convenience, we provide the AbstractIntentService
class, which implements that method, so you do not have to do in your actual class if you derive it.
AndroidAnnotations was created by Pierre-Yves Ricau and is sponsored by eBusinessInformations.
09/11/2014 The 3.2 release is out !
- Get started!
- Download
- Cookbook, full of recipes
- Customize annotation processing
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow