connectivity-samples
connectivity-samples copied to clipboard
Broadcasting Fails on Android 9.0
I am testing this app on Android 9.0 and upon hitting the Broadcast Switch I get the below error:
2019-06-11 18:50:19.661 28219-28219/com.example.android.bluetoothadvertisements E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.bluetoothadvertisements, PID: 28219
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=0x40 color=0x00000000 vis=PRIVATE)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1745)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
How would I go about resolving this problem?
On an unrelated note, the app also works for Android SDK 24 (Nougat) despite the minimum requirements being Android SDK 27 (Oreo 8.1) -- is this also a bug?
UPDATE: I have fixed the original issue using a solution posted from this issue and have hopped on another problem: the app works perfectly fine for Android Nougat (which falls below the API 27 minimum requirement) but the app fails to recieve any contacts on Android Pie. (Broadcasting itself works fine)
Thanks for reporting this issue. Has it been resolved?