Comments (15)
Thank you first, i am sure that i had enable Location and make it be ON. And i used setUseHardwareBatchingIfSupported with false, but it does not work too .
from android-scanner-compat-library.
there is no code on how you did the scanning, could you have accidentally turn on the scan filter ?
could it be that other devices already connected and not yet disconnect before SAMSUNG start scanning ?
scanner.startScan(filters, settings, nordic_scanCallback);
hope it is helpful.
from android-scanner-compat-library.
Thank you for response,and i confirm that the device had not connected.The same problem is found on nRf toolbox and nRf Connect when i tested!
Follow is my code
final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
final ScanSettings settings = new ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).setReportDelay(1000).setUseHardwareBatchingIfSupported(false).build();
List<ScanFilter> scanFilters = new ArrayList<>();
if(mIsScanning) {
cancelLeScan();
}
if(scanCallback == null) {
scanCallback = new MyScanCallBack();
}
scanner.startScan(scanFilters, settings, scanCallback);
mIsScanning = true;
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (mIsScanning) {
cancelLeScan();
}
}
}, SCAN_DURATION);
There are any problem? Thank you again.
from android-scanner-compat-library.
Try passing null as filters, instead of an empty array.
Are you sure you have and granted the location permission (coarse it fine) if using Marshmallow or newer?
from android-scanner-compat-library.
I am sure i had granted the location permission and i tested on Android 6.0. I will change the param according to your advice and test again.Thank you very much!
from android-scanner-compat-library.
``09-18 09:46:41.677 19958-19958/com.isport.isporttracker D/BluetoothLeScanner: Start Scan
09-18 09:46:41.678 19958-19958/com.isport.isporttracker D/BluetoothAdapter: STATE_ON
09-18 09:46:41.679 19958-19958/com.isport.isporttracker D/BluetoothAdapter: STATE_ON
09-18 09:46:41.680 19958-19958/com.isport.isporttracker D/BluetoothAdapter: STATE_ON
09-18 09:46:41.681 19958-19958/com.isport.isporttracker D/BluetoothAdapter: STATE_ON
09-18 09:46:41.787 19958-19971/com.isport.isporttracker D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5 mClientIf=0
09-18 09:46:42.674 19958-19958/com.isport.isporttracker E/BleService: onBatchScanResults size = 0
09-18 09:46:43.677 19958-19958/com.isport.isporttracker E/BleService: onBatchScanResults size = 0
09-18 09:46:44.679 19958-19958/com.isport.isporttracker E/BleService: onBatchScanResults size = 0
09-18 09:46:45.681 19958-19958/com.isport.isporttracker E/BleService: onBatchScanResults size = 0
09-18 09:46:46.684 19958-19958/com.isport.isporttracker E/BleService: onBatchScanResults size = 0
09-18 09:46:47.687 19958-19958/com.isport.isporttracker E/BleService: onBatchScanResults size = 0
09-18 09:46:48.690 19958-19958/com.isport.isporttracker E/BleService: onBatchScanResults size = 0
09-18 09:46:49.693 19958-19958/com.isport.isporttracker E/BleService: onBatchScanResults size = 0
09-18 09:46:50.696 19958-19958/com.isport.isporttracker E/BleService: onBatchScanResults size = 0
09-18 09:46:51.698 19958-19958/com.isport.isporttracker E/BleService: onBatchScanResults size = 0
09-18 09:46:51.799 19958-19958/com.isport.isporttracker D/BluetoothAdapter: STATE_ON
09-18 09:46:51.801 19958-19958/com.isport.isporttracker D/BluetoothAdapter: STATE_ON
09-18 09:46:51.803 19958-19958/com.isport.isporttracker D/BluetoothAdapter: STATE_ON
09-18 09:46:51.805 19958-19958/com.isport.isporttracker D/BluetoothAdapter: STATE_ON
09-18 09:46:51.805 19958-19958/com.isport.isporttracker D/BluetoothLeScanner: Stop Scan
the size that return in onBatchScanResults always is zero, even on-off bluetoothadapter.
the scan method is
final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
final ScanSettings settings = new ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).setReportDelay(1000).setUseHardwareBatchingIfSupported(false).build();
scanner.startScan(null, settings, scanCallback);
mIsScanning = true;
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (mIsScanning) {
cancelLeScan();
}
}
}, SCAN_DURATION);
I tested on SAMSUM S7 and S6.
When it happened, it happened on nrf Connect too.
What should i do.
from android-scanner-compat-library.
Did you try to enable Location in Android drop down menu? Some devices require it to be ON. Doesn't matter what accuracy you set. Also, you may try using https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/master/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScanSettings.java#L401 with false, as batching fails on some devices. This will, however, impact battery usage.
from android-scanner-compat-library.
Same issue with stock android 7.1 frimwares on xperia
from android-scanner-compat-library.
BluetoothLeScanner on android 6.0.1 (ss s6 edge) cannot found device android >= 6.0.1
i had enable permission for App in AndroidManifest.xml file as following:
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
from android-scanner-compat-library.
Hello,
Did you manage to solve the issue?
Did you requested Location runtime permission? You may grant it Settings -> Applications -> Your app -> Permissions -> switch the Location switch to ON and try scanning.
from android-scanner-compat-library.
HI, did you manage to solve the issue?
from android-scanner-compat-library.
Did you try to enable Location in Android drop down menu? Some devices require it to be ON. Doesn't matter what accuracy you set. Also, you may try using https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/master/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScanSettings.java#L401 with false, as batching fails on some devices. This will, however, impact battery usage.
Might I ask why some devices requires it to be on and others not?
from android-scanner-compat-library.
Well... it should be required in all phones. The Location setting is a master switch for all location based features of the phone.
But some manufacturers decided to do otherwise. As Android is open source, they are free to do so. Actually, Samsung now also requires it in Android Pie+.
from android-scanner-compat-library.
Well... it should be required in all phones. The Location setting is a master switch for all location based features of the phone.
But some manufacturers decided to do otherwise. As Android is open source, they are free to do so. Actually, Samsung now also requires it in Android Pie+.
I just thought it was strange because only the OnePlus 3 of the 6 different devices I've tried requires it to be on, even the Nexus 5X does not even though it is vanilla Android, so it's strange that google doesn't enforce it themselves.
And I'm not required to have location enabled when I use bluetooth headsets even though they are bluetooth 4.1.
I just want some clarity here.
And what do you think is the best solution? I don't want to ask the user to enable location on devices that does not require it to be on. So is there some kind of check I can do to see if location must be enabled on this particular device?
from android-scanner-compat-library.
Location is required only for scanning Bluetooth LE devices. Your headset is Classic Bluetooth and perhaps already paired.
Check what we do in nRF Blinky. We start scanning initially showing a warning to enable Location, but if we find a device despite it being disabled, we save internally that the phone doesn't need it and no longer allow it.
from android-scanner-compat-library.
Related Issues (20)
- Is there a non AndroidX version? HOT 1
- If the app is repeatedly killed, the device cannot be scanned
- Filter does not update in run time (using Pending intent) HOT 1
- Cannot stop scan when using PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_MUTABLE HOT 1
- NoClassDefFoundError: Failed resolution HOT 4
- Scan occassionally returns no results until restarted HOT 3
- Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference HOT 1
- Android 12 cannot scan out beacon devices HOT 2
- (Long Range (Bluetooth 5.2)) LE Coded PHY HOT 3
- setUseHardwareBatchingIfSupported HOT 4
- No scan results - Pixel 6a Android 13 HOT 3
- 广播名没有修改
- Failed to resolve BluetoothLeScannerCompat when used through a library
- Hit
- Leaked scan callback when app be killed by task manager
- Could not find no.nordicsemi.android:thingylib:2.0.0. HOT 2
- Hello, I may need your help
- Not discovering "Limited Discoverable" devices in Android
- BLE Scanner not working in Android 14
- An error occurred when quickly switching Bluetooth on and off and stopping scanning status. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-scanner-compat-library.