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

[email protected] getting crashed while start the service #110

Open
dassram17 opened this issue Nov 23, 2019 · 1 comment
Open

[email protected] getting crashed while start the service #110

dassram17 opened this issue Nov 23, 2019 · 1 comment

Comments

@dassram17
Copy link

[email protected] getting crashed while start the service

@MaxKicw
Copy link

MaxKicw commented Mar 28, 2020

Hey @dassram17,

I had the same problem at Android 8 (API26+). I upgraded my working App from TargetApi 26 to TargetApi 28 (Android 8) and this Plugin didn't work anymore. It always caused a crash as the app started going into Background-Mode.

The Logs showed this error:

--------- beginning of crash 2020-03-28 11:55:12.456 /? E/AndroidRuntime: FATAL EXCEPTION: main Process: android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 color=0x00000000 vis=PRIVATE) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1945) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

As it says in the new documentation from Android 8:

Before you can deliver the notification on Android 8.0 and higher, you must register your app's notification channel with the system by passing an instance of NotificationChannel to createNotificationChannel(). So the following code is blocked by a condition on the SDK_INT version

https://developer.android.com/training/notify-user/build-notification

It works now with my adjustments

So the crash is caused, because the notification of this plugin has no channel defined. After I found out about this problem, I created a copy of this plugin. I created a Notification Channel and added it to the notification of this plugin. Now it works find, without crashes!

https://github.com/MaxKicw/background-activity-plugin

Hope it helps!

Not sure how we can merge my fix with this branch. Mabye need some help, If this ist possible :) @pmwisdom

Cheers,
Max

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