Fatal exception. Bad notification for startForeground.
See original GitHub issueThis exception occurs in SDK 27 (Android 8.1) but not in lower SDK versions.
Fatal Exception: 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=0x42 color=0x00000000 groupKey=com.clamber vis=PRIVATE)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Turning off notifications prevents the exception from occurring.
const options = {
// ...
notification: {
// Required to prevent
enabled: false,
},
};
The issue appears to be fairly common and widely document for other libraries. I believe this is the same issue on SO.
I don’t have a reproduction available but I believe there is one in an issue on this other upload library
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
startForeground fail after upgrade to Android 8.1
After some tinkering for a while with different solutions i found out that one must create a notification channel in Android 8.1 and...
Read more >Bad notification for startForeground crash on >= Android 8.1 ...
@philips77 I am experiencing the same issue, which crashes our app whenever we try to run a DFU. Here is the error: FATAL...
Read more >Bad notification for startForeground: java.lang ... - 51CTO博客
RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException,安卓开发8.1以上系统启动服务和通知报错 android.app.
Read more >DFU App Crash - Bad notification for startForeground
So I came across an issue while working on developing an app that can update firmware OTA. I was using Nordic Semi -...
Read more >【错误记录】前台进程报错( Bad notification for ... - CSDN博客
RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Using APK 28. After searching and searching I finally found this thread. I turned notification off. Now the app doesn’t crash. Instead, it throws this error: “Android Oreo requires a notification configuration for the service to run. https://developer.android.com/reference/android/content/Context.html#startForegroundService(android.content.Intent)”
Ready for review.