<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>NRF BLE Android - My BleScannerCompat doesn&amp;#39;t detect a device, but nrf connect does</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/77366/nrf-ble-android---my-blescannercompat-doesn-t-detect-a-device-but-nrf-connect-does</link><description>Hi, I&amp;#39;m having this trouble since some weeks ago and I was looking for an answer in documentation and was impossible to find it. 
 I have a device with Nordic ble chip and I&amp;#39;m trying to find it trough android scanner&amp;#39;s library (BluetoothLeScannerCompat</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 06 Jan 2022 11:20:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/77366/nrf-ble-android---my-blescannercompat-doesn-t-detect-a-device-but-nrf-connect-does" /><item><title>RE: NRF BLE Android - My BleScannerCompat doesn't detect a device, but nrf connect does</title><link>https://devzone.nordicsemi.com/thread/346437?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 11:20:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eff06af2-52ef-4fe2-bc4b-7c4b752d2cea</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Thank you for sharing what you have found, @kvc!&lt;br /&gt;&lt;br /&gt;It could indeed be that the device was filtered out due to low RSSI, but I still suspect that Joel&amp;#39;s issue might have been with the enabling/usage of the BLE adapter - since they were able to find the device with both the native BLE scan through &amp;#39;settings&amp;#39; and the nRF Connect application (after which it was also discovered in their own application).&lt;br /&gt;&lt;br /&gt;If this is still an issue for you I recommend that you open a separate ticket for this issue, to receive help debugging it! :)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF BLE Android - My BleScannerCompat doesn't detect a device, but nrf connect does</title><link>https://devzone.nordicsemi.com/thread/345518?ContentTypeID=1</link><pubDate>Fri, 31 Dec 2021 01:06:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10e6c12c-1f61-4841-b6ca-39365900c2db</guid><dc:creator>KVC</dc:creator><description>&lt;p&gt;I have similar problem.&amp;nbsp; I am able to detect it in using nrf connect app, but not in nrf Blinky app.&amp;nbsp; Though in my case, the nrf Blinky app is still not able to detect it even after nrf connect app has detected it.&amp;nbsp; In my case, my nrf device was far away and the rssi&amp;nbsp;was very low.&amp;nbsp; There is a function isNoise() in ScannerViewModel.java that would filter out low rssi device.&lt;/p&gt;
&lt;p&gt;Perhaps not the kind of problem you have...Just pointing out what I found.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF BLE Android - My BleScannerCompat doesn't detect a device, but nrf connect does</title><link>https://devzone.nordicsemi.com/thread/319863?ContentTypeID=1</link><pubDate>Tue, 13 Jul 2021 14:34:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:775fb998-aca7-456d-b9c4-7217c79b62e3</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again,&lt;br /&gt;&lt;br /&gt;Thank you for your patience with this. The summer holidays have begun here in Norway, and DevZone is therefore operating with reduced staff for the time being. Sorry for any inconvenience this might cause.&lt;/p&gt;
[quote user="joel.aa"]thanks for the answer.[/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="joel.aa"]This is the code:[/quote]
&lt;p&gt;Thank you for sharing the code.&lt;br /&gt;Briefly looking through it I do not see anything immediately out of the ordinary. What changes have you made to your &lt;em&gt;AndroidManifest&lt;/em&gt;?&lt;br /&gt;Please &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/50642/background-operation-of-ble-library-with-android-8---request-for-example"&gt;see the answer and project uploaded by my colleague Aleksander in this ticket&lt;/a&gt;, he is one of the developers of the module. I have not tested this project yet myself either, but looking over the code it looks to be a good match for the functionality you describe (apart from the filtering).&lt;br /&gt;I have sent Aleksander a message, asking for an update on this ticket - if he has had time to review the project, but he is currently on vacation and will not return for a couple of weeks yet.&lt;/p&gt;
[quote user="joel.aa"]How can I enable BLE adapter in my app? I was using nordic chip in other devices but I never had this problem.[/quote]
&lt;p&gt;I am not sure I understand what you mean by this - is the issue not that your smartphone application does not start scanning on its own?&lt;br /&gt;Did you use this exact code on another device, which had a Nordic chip onboard, with a different result than the behavior you are seeing now?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF BLE Android - My BleScannerCompat doesn't detect a device, but nrf connect does</title><link>https://devzone.nordicsemi.com/thread/319626?ContentTypeID=1</link><pubDate>Mon, 12 Jul 2021 14:13:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:218738ba-1da7-423b-a33b-1660252fe47a</guid><dc:creator>joel.aa</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;thanks for the answer.&lt;/p&gt;
&lt;p&gt;This is the code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;private var scanner = BluetoothLeScannerCompat.getScanner()

fun scan(mac: String?, listener: ScanListener) {
    scanner.stopScan(mScannerCallback)
    val settings: ScanSettings = ScanSettings.Builder()
        .setLegacy(false)
        .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
        .setReportDelay(500)
        .setUseHardwareBatchingIfSupported(true)
        .build()

    scanner.startScan(arrayListOf(), settings, scannerCallback(mac, listener))
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is the mScannerCallback:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;private fun scannerCallback(mac: String?, listener: ScanListener?): ScanCallback {
    mScannerCallback = object : ScanCallback() {
        override fun onScanFailed(errorCode: Int) {
            super.onScanFailed(errorCode)
            Log.d(TAG, &amp;quot;onScanFailed $errorCode&amp;quot;)
        }

        override fun onBatchScanResults(results: MutableList&amp;lt;ScanResult&amp;gt;) {
            super.onBatchScanResults(results)
            for(item in results) {
                item.device.name?.let {
                    Log.d(TAG, &amp;quot;device name ${item.device.name}&amp;quot;)
                    if(item.device.name != null &amp;amp;&amp;amp; item.device.name.toUpperCase(Locale.getDefault()).contains(&amp;quot;____&amp;quot;)) {
                        if(isEmpty(mac) || mac == item.device.address) {
                            listener?.newDevice(item)
                        }
                    }
                }
            }
        }
    }
    return mScannerCallback
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;How can I enable BLE adapter in my app? I was using nordic chip in other devices but I never had this problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF BLE Android - My BleScannerCompat doesn't detect a device, but nrf connect does</title><link>https://devzone.nordicsemi.com/thread/319596?ContentTypeID=1</link><pubDate>Mon, 12 Jul 2021 12:46:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0be4ac32-daad-49e8-8bbe-b941a0942bb3</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]But when I turn on the nrf connect app or bluetooth settings from phone settings, I see this device and, later, it appears in my app&amp;#39;s scanner.[/quote]
&lt;p&gt;This leads me to believe that you are not enabling the BLE adapter in your application, or something similar.&lt;br /&gt;From this description I am thinking that you are&amp;nbsp;&lt;em&gt;using&lt;/em&gt; the BLE adapter correctly, but not starting it properly. This way, if it is properly started (such as through the nRF Connect application for smartphone, or through the Bluetooth settings directly), then everything would work fine. Could this be the case?&lt;br /&gt;&lt;br /&gt;Could you possibly show me the rest of your scanner initialization and start code as well?&lt;br /&gt;Please use&amp;nbsp;&lt;em&gt;Insert -&amp;gt; Code&amp;nbsp;&lt;/em&gt;when sharing code on DevZone.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>