pingpongboss / StandOut

StandOut lets you easily create floating windows in your Android app.
http://pingpongboss.github.com/StandOut
MIT License
1.24k stars 379 forks source link

RemoteServiceException for Android 9 and Android 10 #45

Closed vsay01 closed 4 years ago

vsay01 commented 4 years ago

It's working fine for Android 8 but error with Android 9 and Android 10.

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 tick defaults=0x0 flags=0x60 color=0x00000000 vis=SECRET internalType=0 internalPriority=0 internalGroupPriority=0 internalFlag=0)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1965)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:224)
       at android.app.ActivityThread.main(ActivityThread.java:7081)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:536)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:928)

Anyone find solutions for this ?

vsay01 commented 4 years ago

I resolved this by create channel before create notification in getPersistentNotification(int id) of StandOutWindow class.