Fred Wilby
Fred Wilby

Reputation: 11

android not detecting BLE devices

I'm trying to write an app to connect to a BLE device (using a Cypress PSoC pioneer board) my team is working on. Right now I'm hung up on getting the app to detect any devices at all.

I'm testing the app on an HTC Desire 510, and the device I'm trying to detect is the PSoC board running Cypress's proximity sensor example.

After lots of frustration, I tried running the entire API-21 BluetoothLEGatt sample on my device and it detects (and can connect to) the board no problem.

I then tried copying the entire DeviceScanActivity into my project making only the following modifications:

My AndroidManifest has both BLUETOOTH and BLUETOOTH_ADMIN and is setup to launch the activity directly.

When I run it in my project the phone doesn't detect any devices, and I get the following logcat output when scanning:

04-13 17:51:25.350    3892-3892/com.fredwilby.chipper D/BluetoothAdapter﹕ startLeScan(): null
04-13 17:51:25.350    3892-3903/com.fredwilby.chipper D/BluetoothAdapter﹕ onClientRegistered() - status=0 clientIf=5
04-13 17:51:27.350    3892-3892/com.fredwilby.chipper I/Choreographer﹕ Skipped 120 frames!  The application may be doing too much work on its main thread.
04-13 17:51:31.940    3892-3892/com.fredwilby.chipper D/BluetoothAdapter﹕ stopLeScan()

compared to the output when I scan from the Sample project:

04-13 18:05:36.750    6887-6887/com.example.android.bluetoothlegatt D/BluetoothAdapter﹕ startLeScan(): null
04-13 18:05:36.750    6887-6899/com.example.android.bluetoothlegatt D/BluetoothAdapter﹕ onClientRegistered() - status=0 clientIf=5
04-13 18:05:37.120    6887-6898/com.example.android.bluetoothlegatt D/BluetoothAdapter﹕ onScanResult() - Device=00:A0:50:00:00:69 RSSI=-59
04-13 18:05:37.120    6887-6898/com.example.android.bluetoothlegatt D/BluetoothDevice﹕ getService() entry
04-13 18:05:38.080    6887-6887/com.example.android.bluetoothlegatt D/BluetoothAdapter﹕ stopLeScan()

I don't get the message about skipped frames everytime I scan from my app, but it's quite frequent and was even more so when I was trying to make code I wrote work.

I've tried rebooting the device to no avail, and I really don't know what else I can try at this point. Does anyone have any insight into how I can get this to work?

I'm happy to post any other information that would be helpful. I've omitted the code here because, as I mentioned above, it's identical to the sample except for very minor cosmetic tweaks (nothing anywhere near the scanning code).

Upvotes: 0

Views: 1574

Answers (1)

Fred Wilby
Fred Wilby

Reputation: 11

Well, I managed to fix it by removing <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="21" /> from my AndroidManifest. Of course this is kind of an infuriating fix and I'd appreciate if anyone had any insight into why this happens.

Upvotes: 1

Related Questions