Call my.offBLEConnectionStateChanged to remove any existing listener before calling my.onBLEConnectionStateChanged, to avoid registering duplicate listeners that each fire on the same event. IDE simulation is not supported for this API — test on a real device.