The p4android backend seem to have a bug in the BleakClientP4Android.pair() method.
When called, the function is working but always crash with the exception TypeError: object NoneType can't be used in 'await' expression.
Run the kivy example with an added await client.pair() after the client connection.
Logs
03-28 19:38:56.988 22522 18640 I python : Traceback (most recent call last):
03-28 19:38:56.989 22522 18640 I python : File "/REDACTED/.buildozer/android/app/main.py", line 327, in _handle_sensor
03-28 19:38:56.989 22522 18640 I python : File "/REDACTED/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/androidkivytest/arm64-v8a/bleak/__init__.py", line 640, in pair
03-28 19:38:56.989 22522 18640 I python : File "/REDACTED/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/androidkivytest/arm64-v8a/bleak/backends/p4android/client.py", line 213, in pair
03-28 19:38:56.990 22522 18640 I python : TypeError: object NoneType can't be used in 'await' expression
bluetoothctl -v
) in case of Linux:Description
The p4android backend seem to have a bug in the BleakClientP4Android.pair() method. When called, the function is working but always crash with the exception
TypeError: object NoneType can't be used in 'await' expression
.This is caused by the line
await receiver.stop()
. It look like the BroadcastReceiver.stop() method is just a plain def, not a async def : https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/recipes/android/src/android/broadcast.py#L67What I Did
Run the kivy example with an added
await client.pair()
after the client connection.Logs