Android Question BLE Enable Notifications question Android 16 vs Android 10

walterf25

Expert
Licensed User
Longtime User
Hi all, it's been a while since i've posted a question, I have built an app that uses BLE protocol, it scans for a specific device name, connects to it when found. I have the following function to enable notifications

B4X:
Public Sub EnableNotifications As ResumableSub
    Dim notify As Boolean
    
    notify = Common.manager.SetNotify(SEAT_SERVICE, SEAT_STATUS_CHARACTERISTIC, True)
    LogColor("SetNotify SEAT_STATUS: " & notify, xui.Color_Blue)
    
    Sleep(200)
    
    notify = Common.manager.SetNotify(SEAT_SERVICE, SEAT_MOTION_CTRL_RESP_CHARACTERISTIC, True)
    LogColor("SetNotify SEAT_MOTION_CTRL_RESP: " & notify, xui.Color_Blue)
    Return notify
End Sub

This works very well on my Samsung Galaxy S24 Ultra running Android OS 16, but when my client is testing on an android Samsung S9 running on Android 10, we are not seeing the Notifications being enabled in the logs, has anyone in here come across this problem and how was resolved. The only thing I can think of is the OS version difference but in theory it should work the same, I have the necessary permissions in my manifest and also using runtime permission library to request them, and it works fine on my Samsung S24.

What else can be the issue here?

Any suggestions?

Thanks,
 

drgottjr

Expert
Licensed User
Longtime User
sdk 33 replaced some methods (among which, onChangeCharacteristic()). i don't remember, but i think setting notification probably works its way around to onChangeCharacteristic(). if your routine works with android 16, it wouldn't be surprising that it fails with android 10. i suppose it could fail silently, but since there is no exception, my comment might not even be relevant. but you could look into it.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…