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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Android requires that, when implementing of a IntentService, we create a default constructor that matches:
public IntentService(String name)
Without this constructor, AndroidAnnotation will throw an error while compiling.
Error:(15, 8) Gradle: error: constructor IntentService in class IntentService cannot be applied to given types;
required: String
found: no arguments
reason: actual and formal argument lists differ in length
Creating the constructor 'suggested' by AndroidStudio/Intellij, also doesn´t help:
Error:(13, 14) Gradle: error: constructor MyIntentService in class MyIntentService cannot be applied to given types;
required: String
found: no arguments
reason: actual and formal argument lists differ in length
I think that the example @EIntentService documentation page should consider this issue. Something like this should solve the question:
@EIntentService
public class MyIntentService extends IntentService {
//Constructor that matches IntentService´s default constructor
public MyIntentService() {
super("MyIntentService Name");
}
@ServiceAction
void mySimpleAction() {
// ...
}
@ServiceAction
void myAction(String param) {
// ...
}
@Override
protected void onHandleIntent(Intent intent) {
// Do nothing here
}
}
Also, the example that shows how to start the service should be:
Activity
WonderCsabo commentedon Feb 22, 2015
Thanks for reporting! Actually we should validate that the class has no-arg constructor. I will add that and also edit the wiki.
karlapdiaz commentedon Mar 10, 2015
what is the solution???
regisoliveira commentedon Mar 11, 2015
Karla,
Please check the update documentation. The example provided is working
correctly.
https://github.com/excilys/androidannotations/wiki/Enhance%20IntentServices
2015-03-10 20:49 GMT-03:00 Karla Patricia Díaz Padilla <
notifications@github.com>: