Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

@EIntentService Document Improvement #1327

Copy link
Copy link
@regisoliveira

Description

@regisoliveira
Issue body actions

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:

MyIntentService_.intent(getApplication()) //
    .myAction("test") // 
    .start(); 
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.