Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create Service in Java #3

Open
VT-ChiragBhuva opened this issue Jul 30, 2021 · 1 comment
Open

Unable to create Service in Java #3

VT-ChiragBhuva opened this issue Jul 30, 2021 · 1 comment

Comments

@VT-ChiragBhuva
Copy link

When I try to create a service by extending ForegroundTaskService in java at that time I am getting error in android studio.

error: MyForegroundService is not abstract and does not override abstract method onBind(Intent) in Service public class MyForegroundService extends ForegroundTaskService {

'onBind(Intent)' in 'com.rotemati.foregroundsdk.external.services.BaseForegroundTaskService' clashes with 'onBind(Intent)' in 'android.app.Service'; attempting to use incompatible return type

and when I override the OnBind method in my class, it also displays an error.

Kindly advise me on how can I run my code and also provide a full example in JAVA.

My Service Class look like this,

public class MyForegroundService extends ForegroundTaskService {
    @Override
    public Result doWork() {
        return Result.Success;
    }

    @Override
    public Notification getNotification() {
        //Display Notification
    }

    @Override
    public Result onStop(StoppedCause stoppedCause) {
        return Result.Failed;
    }
}
@rotman
Copy link
Contributor

rotman commented Mar 16, 2022

Hi @VT-ChiragBhuva and thanks for pointing this out :)
Sorry for not being responsive.
To work around this issue, just override the onBind method in your service.
In the meantime, I will look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants