Android 13中Kivy应用程序的蓝牙权限

huangapple go评论81阅读模式
英文:

Permission BLUETOOTH for Android 13 in kivy app

问题

我是一个初学者的Kivy用户。我制作了一个通过蓝牙在移动设备上显示Arduino数据的应用程序。我在buildozer.spec中允许访问如下:

android.permissions = BLUETOOTH_ADMIN,BLUETOOTH

这个应用程序之前运行得很好,但现在无法在我的安卓设备上运行。我收到了以下错误:

JVM异常发生:需要android.permission BLUETOOTH CONNECT权限用于AttributionSource(uid-10316包名org test.myapp,属性标签-null,令牌android.os.BinderProxy@df550d7,下一个null):Adapter Service getBondedDevices java.lang.securityException

我该如何修复这个错误?

我的应用程序在Android 11及以下版本上运行正常,但在我的Android版本为13的手机上无法运行。

在此提前感谢您的帮助。

英文:

I am a beginner Kivy user. I made an app that displays Arduino data on mobile via Bluetooth. I allow access in buildozer.spec as follows:

android.permissions = BLUETOOTH_ADMIN,BLUETOOTH

The app worked well ,but now it can't run on my android. I get an error like below:

JVM exception occurred : Need android.permission BLUETOOTH CONNECT permission for AttributionSource ( uid - 10316 packageName org test.myapp , attribution Tag- null , token android.os.BinderProxy@df550d7 , next null ) : Adapter Service getBondedDevices java.lang.securityException

How do I fix this error?

My app works fine on Android 11 and below but it doesn't work on my mobile which its Android is 13.
Thank you in advance for your help

答案1

得分: 1

from android.permissions import request_permissions, Permission
request_permissions([Permission.BLUETOOTH_CONNECT, Permission.BLUETOOTH_SCAN ])

英文:

Add this code to your main.py program:

from android.permissions import request_permissions, Permission 
request_permissions([Permission.BLUETOOTH_CONNECT,Permission.BLUETOOTH_SCAN ])

答案2

得分: 0

在 Android 12 及以上版本,您需要请求用户授予BLUETOOTH_SCANBLUETOOTH_CONNECT权限。在 Android 12 以下版本,您需要请求ACCESS_FINE_LOCATION权限。

英文:

In android 12 above You need to ask from the user
BLUETOOTH_SCAN and BLUETOOTH_CONNECT permission both.
under android 12 you need to ask ACCESS_FINE_LOCATION permission

huangapple
  • 本文由 发表于 2023年2月8日 20:57:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/75386150.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定