2016-07-15 5 views
0

おはようございます、Android 6に問題があります。どうすれば自動的にBluetoothを有効にすることができますか? tiapp.xmlをプラグインしましたチタンブルートゥースパーミッションアンドロイド6

<uses-permission android:name="android.permission.BLUETOOTH"/> 
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> 

ただし、動作しません。私は常にアプリケーション管理に入り、位置情報サービスを有効にする必要があります。

答えて

0

あなたのアプリがパワーマネージメントアプリである場合を除いて、あなたのアプリでBluetoothを有効/無効にするべきではありませんが、エンドユーザがクリックすると有効/無効にする必要があります。

本当にやりたければ、BluetoothAdapterでenable()とdisable()APIを呼び出してください。

あなたにも、次の権限を追加できます:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

0
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