-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android example permissions broken #1363
Comments
Does it work if you change the permissions for the app on the Android device? |
Hi @Jayy001 Try to install the app via: 'adb install -g app.apk', the -g flag should grant all runtime permissions, see if this fixes the error. |
Should be fixed by #1398 |
@dlech This can be quite easily done, I have a fix for this ready, but it still needs testing. As mentioned above, the issue can be temporarily fixed by installing the apk using 'adb install -g app.apk'. Kind regards, |
Can confirm that fixed my issue @robgar2001 and I no longer need to manually add the java files. The only final hurdle I had was to install Sorry this took so long, I had completely forgotten about this issue |
@dlech if selected_device.name.startswith("GAN"):
cube = GanCube(selected_device.address)
cube.name = selected_device.name
cube.address = selected_device.address
print(f"Connecting to {cube.name}, {cube.address}")
async with BleakClient(cube.address) as client:
cube_service = None
for service in client.services:
if service.uuid == cube.SERVICE_UUID:
cube_service = service
break
if cube_service is None:
print(f"Unable to find {cube.BRAND} CUBE service or unsppported {cube.BRAND} CUBEs")
return
read_chrct = None
write_chrct = None
for chrct in cube_service.characteristics:
if chrct.uuid == cube.CHRCT_UUID_READ:
read_chrct = chrct
elif chrct.uuid == cube.CHRCT_UUID_WRITE:
write_chrct = chrct
if read_chrct is None or write_chrct is None:
print(f"Unable to find {cube.BRAND} CUBE read or write characteristic")
return
print(f"Connected to {cube.BRAND} CUBE")
await client.start_notify(read_chrct, gan_read_handler) Now this works fine when I run it on my computer (can read the characteristic just fine), but when I run it from my android device it gives that error. Any ideas as to what could be messing it up? Running it with |
Does the characteristic actually support notifications (i.e. run the service_explorer sample or use nRF Connect app to enumerate everything to see what is there)? |
Hi @Jayy001 Typing-extensions was indeed still missing as a requirement. I also added the code to request permissions on startup, aldough it seems to be a bit buggy. Maybe you can test and have a look at it on your device before I submit a pull request? Link to my bleak fork: https://github.com/robgar2001/bleak Kind regards, |
yes,
It's 100% a problem with the android version, as I have run this exact application before on my computer with no issues. Furthermore, when scanning for characteristics/descriptors it does show 1 descriptor available - it's only when I try to connect to it that the bug occurs. |
Can do, will let you know |
Is the problems solved? I meet the same problem. |
Greets check my app if you're having trouble: |
bluetoothctl -v
) in case of Linux:Description
Trying to run the basic example given for android
https://github.com/hbldh/bleak/tree/develop/examples/kivy
What I Did
Added Java files from https://github.com/hbldh/bleak/tree/develop/bleak/backends/p4android/java/com/github/hbldh/bleak to local folder
java
and inbuildozer.spec
modifedandroid.add_src = java
Logs
The text was updated successfully, but these errors were encountered: