【问题标题】:titanium bluetooth permision android 6钛蓝牙权限 android 6
【发布时间】:2016-07-15 10:13:15
【问题描述】:
晚上好,我在使用 Android 6 时遇到问题。如何启用自动启用蓝牙功能?
我插入了tiapp.xml
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
但不起作用。我总是要进入应用管理并激活定位服务。
【问题讨论】:
标签:
android
bluetooth
titanium
appcelerator
【解决方案1】:
一般来说,除了你的应用是电源管理应用外,你不应该在你的应用上启用/禁用蓝牙,而是让最终用户点击启用/禁用它。
但是,如果您真的想这样做,只需在 BluetoothAdapter 调用 enable() 和 disable() API。
您不妨添加以下权限:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
【解决方案2】:
Binder: Caught a RuntimeException from the binder stub implementation.
[WARN] : Binder: java.lang.SecurityException: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results
[WARN] : Binder: at android.os.Parcel.readException(Parcel.java:1620)
[WARN] : Binder: at android.os.Parcel.readException(Parcel.java:1573)
[WARN] : Binder: at android.bluetooth.IBluetoothGatt$Stub$Proxy.startScan(IBluetoothGatt.java:883)
[WARN] : Binder: at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper.onClientRegistered(BluetoothLeScanner.java:375)
[WARN] : Binder: at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:56)
[WARN] : Binder: at android.os.Binder.execTransact(Binder.java:453)
我必须启用位置信息。作为照片
enter image description here