esc_pos_bluetooth
esc_pos_bluetooth copied to clipboard
android bluetotth scaning not working,ios working
Android Not scanning, ios working, is there. any option to scan paired devices ?
Same issue, any solutions ??
solved the issue with adding permission from flutter also added android manifest.xml
var statusLocation = Permission.location; var statusScan = Permission.bluetoothScan; var statusConnect = Permission.bluetoothConnect; if (Platform.isAndroid) { if (await statusLocation.isDenied) { await [ Permission.location, ].request(); }
if (await statusLocation.isGranted &&
await statusScan.isGranted &&
await statusScan.isGranted) {
commonPrint('all grnted');
// do scan bluetooth device function
}
@iyashiyas @ferns-it can you share your AndroidManifest and a more detailed code snippet? Specifically have you used permission_handler package?
@iyashiyas @ferns-it I was able to figure out. Thank you. However, it does not work with Android 12. Worked fine with Android 9.
Android 12 doesn't work initially. You'll have to follow this: https://stackoverflow.com/questions/70578601/android-12-ble-scan-does-not-find-any-devices
As a result, I had these in the Android manifest file:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Then I request the following permissions at runtime:
await Permission.bluetoothConnect.request();
await Permission.bluetoothScan.request();
await Permission.locationWhenInUse.request();
Thanks ,this works for me I migrated my project to null safety. targeting sdk 30 to 31