android - Since marshmallow update Bluetooth discovery using BluetoothAdapter.getDefaultAdapter().startDiscovery(); is broken -
i have app using bluetooth , connecting devices, can'f find devices using bluetoothadapter.getdefaultadapter().startdiscovery(); worked fine before discovery. tried other apps, doesn't work in other apps well. device try pair (arduino bt-module) can found in android settings. idea try? implemented described on http://developer.android.com/guide/topics/connectivity/bluetooth.html , worked before update.
bluetooth adapter has been change in android 6.0
you need set permission access_fine_location or access_coarse_location permission , need use bluetoothlescanner.startscan() method start scan.
below description change logs:
to provide users greater data protection, in android 6.0, android removes programmatic access device’s local hardware identifier apps using wi-fi , bluetooth apis. wifiinfo.getmacaddress() , bluetoothadapter.getaddress() methods return constant value of 02:00:00:00:00:00.
to access hardware identifiers of nearby external devices via bluetooth , wi-fi scans, app must have access_fine_location or access_coarse_location permissions:
wifimanager.getscanresults() bluetoothdevice.action_found bluetoothlescanner.startscan()
note: when device running android 6.0 (api level 23) initiates background wi-fi or bluetooth scan, operation visible external devices originating randomized mac address.
you can more details link : http://developer.android.com/about/versions/marshmallow/android-6.0-changes.html
Comments
Post a Comment