This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Auto-connection on the nRF Blinky app

Hello,

I downloaded the nRF Blinky app (for Android) here : github.com/.../Android-nRF-Blinky

I'm looking to modfy the code to have an auto connection. For this, I would like to go directly on the second page, and do a filtering by name. If the phone isn't conneted to my board (called ABCDEF for example), the app search BLE devices, and if it found a device called ABCDEF, the app auto-connect to it, and it is possible to control the board with the app.

How can I do it, please ? I've been searching for 3 weeks, and I'm still failing to do this.

Thanks a lot for helping me !

Parents
  • Hi Raven,

    Have you had a look at where we process the scan result ? First you need to scan , then you check in the scan result if the device name of the result(s) is "ABCDEF" If you have in the code, we catch the scan result in onBatchScanResults() in MainActivity.java.

    From the result, you can call mBluetoothDevice.getName(); or result.getScanRecord().getDeviceName(); if scan record is not null. This is done in ExtendedBluetoothDevice.java

    Then if the device name matches, you can send the device address and start controlBlinkIntent as in onItemClick() in MainAcitivity.java

Reply
  • Hi Raven,

    Have you had a look at where we process the scan result ? First you need to scan , then you check in the scan result if the device name of the result(s) is "ABCDEF" If you have in the code, we catch the scan result in onBatchScanResults() in MainActivity.java.

    From the result, you can call mBluetoothDevice.getName(); or result.getScanRecord().getDeviceName(); if scan record is not null. This is done in ExtendedBluetoothDevice.java

    Then if the device name matches, you can send the device address and start controlBlinkIntent as in onItemClick() in MainAcitivity.java

Children
Related