App crashes on android 9.0
See original GitHub issueIssue description
My app crashes on android 9.0(My phone is Xiaomi 8), it works well on earlier platform(Android 6.0, 7.0, 8.0).
It crashes when the screen turns off or I switch to another app.
Error log from Android Studio
Similar to https://github.com/katzer/cordova-plugin-background-mode/issues/393#issue-346518462
2019-02-21 21:08:28.938 6320-6320/cc.cs_tao.whu_library_seat_mobile E/AndroidRuntime: FATAL EXCEPTION: main
Process: cc.cs_tao.whu_library_seat_mobile, PID: 6320
android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=-2 contentView=null vibrate=null sound=null defaults=0x0 flags=0x42 color=0x00000000 vis=PRIVATE)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1760)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
My project info
-
Repo whu-library-seat-mobile#83daf8357ffce4bbda762a04bc9e7005ee43784d
-
Node and Cordova version
- node v8.15.0
- cordova 8.1.2 (cordova-lib@8.1.1)
-
Build environment in travis-ci
android: components: - tools - build-tools-28.0.3 - android-27 - extra-android-m2repository - extra-android-support - extra-google-m2repository licenses: - 'android-sdk-license.*'
-
cordova-plugin-background-mode
versions I have tried -
Other cordova plugins in my project
{ "cordova-android": "~7.1.1", "cordova-plugin-advanced-http": "^2.0.1", "cordova-plugin-badge": "^0.8.7", "cordova-plugin-device": "^2.0.2", "cordova-plugin-file": "^6.0.1", "cordova-plugin-local-notification": "^0.9.0-beta.2" }
Can anyone help me? Many thanks.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:22
Top Results From Across the Web
Mobile App crashes when using phone with Android 9.0
When using a phone running android 9.0 (such as Pixel 2 or Pixel XL), the RE Mobile App will not load and immediately...
Read more >Fix an installed Android app that isn't working - Google Support
Try the following steps if an app installed on your phone has any of these problems: Crashing. Won't open. Won't respond. Isn't working...
Read more >Android 9.0.9 - Google app crash - OnePlus Community
There is a bug associated with Parallel apps, that cause Google app to crash at opening, still no solution to it!
Read more >My app crashes after updating in Android 9(Pie) - Stack Overflow
Yesterday my phone got updated to Android 9 and by that time my app started crashing. I reinstalled it from the Android Studio,...
Read more >Android App Crashes in some Samsung Devices that running ...
We have not been able to reproduce this crash so far. The crash occurs only on Samsung devices with Android 9.0.
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
@markarupert
From the app plugin:
I was looking for another solution and found that:
It fixed my crash issue. Now just need to test if android 9 leaves the app running in the background or it kills it after 5 minutes.
So I just found out that when the
targetSdkVersion
is set to27
, the plugin works perfectly well but when changing it to28
the issue is back, and can only be solved by actively adding theFOREGROUND_SERVICE
permission.I think this issue should be reopened and the permission should be included in the plugin itself.