connectivity-samples icon indicating copy to clipboard operation
connectivity-samples copied to clipboard

Broadcasting Fails on Android 9.0

Open kir12 opened this issue 5 years ago • 3 comments

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?

kir12 avatar Jun 11 '19 22:06 kir12

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?

kir12 avatar Jun 12 '19 17:06 kir12

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)

kir12 avatar Jun 17 '19 19:06 kir12

Thanks for reporting this issue. Has it been resolved?

isaidamier avatar Jun 25 '21 17:06 isaidamier