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

[BUG] Android 8+ service stops #15

Open
Duna opened this issue Oct 22, 2019 · 0 comments
Open

[BUG] Android 8+ service stops #15

Duna opened this issue Oct 22, 2019 · 0 comments

Comments

@Duna
Copy link

Duna commented Oct 22, 2019

The way you start service is killed by OS after 20 seconds
Please have a lecture: https://developer.android.com/about/versions/oreo/background
Use startForegroundService() method instead of startService().

 if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            ctx.startForeground(NOTIFICATION_ID, mBuilder.build());
        } else {
            NotificationManagerCompat notificationManager = NotificationManagerCompat.from(ctx);
            notificationManager.notify(NOTIFICATION_ID, mBuilder.build());
        }

...

@Duna Duna changed the title [BUG] Android 8+ [BUG] Android 8+ service stops Oct 22, 2019
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

1 participant