Enhance IntentServices

Kay-Uwe Janssen edited this page Mar 30, 2017 · 8 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.

public class MyIntentService extends IntentService {

	public MyIntentService() {

	void mySimpleAction() {
		// ...

	void myAction(String param) {
		// ...

	protected void onHandleIntent(Intent intent) {
		// Do nothing here

You can start an enhanced IntentService via the inner Builder :

MyIntentService_.intent(getApplication()) //
	.myAction("test") //

If you invoke multiple actions on the builder, only the last action will be executed.

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.

14/10/2018 The 4.5.1 release is out !

Using AndroidAnnotations


Enjoying AndroidAnnotations

Improving AndroidAnnotations

Extending AndroidAnnotations

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.