SDK8: BluetoothLowEnergy.setConnectionStrategy() not working

Usage of
BluetoothLowEnergy.setConnectionStrategy(BluetoothLowEnergy.CONNECTION_STRATEGY_SECURE_PAIR_BOND);
with SDK 8.0.0 beta leads in SIM to

Error: Symbol Not Found Error
Details: Could not find symbol 'setConnectionStrategy'

Also, the API description looks erraneous to me:

"Using the value of CONNECTION_TYPE_SECURE_PAIR_BOND will pair and bond the device as part of the pairing process."

But CONNECTION_TYPE_SECURE_PAIR_BOND seems to be undefined.
While CONNECTION_STRATEGY_SECURE_PAIR_BOND seems to work.

  • I know  with the production SDKs, if you try to use bonding and run in the sim, you get a similar error.  Something with the sim/Nordic HW used/what's flashed to that HW I think.  I think the message should be clearer if that's the case

    I never tried it but I understand that sideloads do work if the are running the needed FW.  I'd use "has" with the compiler flag to resolve the has at runtime instead of at compile time.

    You tried a sideload?

    I've run many of my BLE apps in the sim with 8.0.0 beta1, but without the new call and they work.

  • What device are you using in the sim?  If this works there, I'd only expect it to work with the "System 8 Preview Device"

  • Good point, probably it will run with the system8 preview device only. Will try. I have tried with Edge 1040 and 1050 in SIM.

  • setConnectionStrategy is definitely only available for the system8preview device. You can verify this without running your app by searching ConnectIQ/Devices/**/*.api.debug.xml for "setConnectionStrategy", and I also verified it in the sim.

    This makes sense since it's a new function for system 8.

  • As a quick test, with the 8.0.0 beta SDK and the System 8 Preview device, I added a call to isBonded, and I get this message.  So like the earlier SDKs and bonding, but with a real message

    what do you see with setConnectionStrategy?

  • Now tested with sdk 8.0.0 beta and the system8 preview device. Yes, this works, code is running. No pairing however, but that may be caused by the sensor. I need to check if the sensor can bond.

  • I have a HRM 200 on order.  Per it's specs, it supports it.

    Transmits data over BLE
    Supports secure BLE connections (with compatible Garmin device)
  • Now tested with sdk 8.0.0 beta and the system8 preview device. Yes, this works, code is running. No pairing however, but that may be caused by the sensor. I need to check if the sensor can bond.

    Given jim_m_58’s error message — “The Connect IQ Simulator does not currently support the bonded BLE APIs” — I don’t expect that you’ll be able to test actual bonding in the simulator. (This is distinct from the fact that your setConnectionStrategy() call is no longer crashing.)

    I imagine that if you test with a sensor that can bond, you should see the same error in the simulator (either that or it will silently refuse to bond)

    I think you will have to test on a real System 8 device (hopefully you have one.)

    Also, if you’re interested in seeing what the old “unfriendly” error message looks like when you tried to call isBonded() or requestBond() in the simulator for previous SDKs, here it is:

    https://forums.garmin.com/developer/connect-iq/i/bug-reports/problems-with-simulator-and-isbonded-requestbond-api

    (Note that the error is “System Error” and the detailed error is “Failed Invoking <symbol>” as opposed to “Symbol Not Found Error”, with the detailed error mentioning the actual API function you tried to call. I don’t think it’s a similar error at all, as “Symbol Not Found Error” is completely straightforward, especially when the error refers to a symbol you tried to reference in your own code.)

    It’s nice that Garmin replaced that with a proper error message.

    Also, the API description looks erraneous to me:

    "Using the value of CONNECTION_TYPE_SECURE_PAIR_BOND will pair and bond the device as part of the pairing process."

    I think that’s worth a bug report.

    Regarding the HRM-200, not to state what’s probably obvious, but Garmin released this product to comply with upcoming EU encryption/authentication requirements, which is the reason that “ANT+ is dead” (long live ANT+) and is probably why  setConnectionStrategy has been introduced.

    https://www.dcrainmaker.com/2025/01/garmin-hrm-depth-review.html

    https://www.dcrainmaker.com/2025/01/the-begining-of-the-end-for-ant-wireless.html

    You would think Garmin would want to eventually support bonding in the simulator, in light of this.

  • As I said in an earlier post, I think you can't bond in the sim due to the Nordic HW/FW used by the sim.

    With 8.0.0 beta, the System 8 preview device, in addition to the message I posted, you do see a crash in the debug console.  The same crash see on on older sdks, but without the extra message.

  • As I said in an earlier post, I think you can't bond in the sim due to the Nordic HW/FW used by the sim.

    Yes I read that post. My point was:

    - the error message that you see for that bonding crash ("System Error" / "Failed Invoking <symbol>"is not at all the same as the one in the OP ("Symbol not found error" / "Could not find symbol 'setConnectionStrategy'). The OP's error message is extremely straightforward and points to the actual error (lack of support for that method in the given device).

    - OP said this:

    "Now tested with sdk 8.0.0 beta and the system8 preview device. Yes, this works, code is running. No pairing however, but that may be caused by the sensor. I need to check if the sensor can bond."

    This implies that they want to test a sensor that can bond in the simulator, but my point is that they probably have to test on a real device.

    In other words, I am violently agreeing with you.