• My wife is using a puck.js everyday in the car to play/pause/next/previous songs she is streaming on the car audio system through Bluetooth. The phone connects automatically to both Bluetooth devices (car's audio system and puck.js through BLE).
    The code which is running on the puck.js is this one:

    var controls = require("ble_hid_controls");
    NRF.setAdvertising({},{name:"MediaButton­",interval:500});
    NRF.setServices({
      0x180F : { // Battery Service
        0x2A19: {  // Battery Level
          readable: true,
          notify: true,
          value : [Puck.getBatteryPercentage()]
    }}}, { hid : controls.report });
    
    
    setInterval(function(){
      NRF.updateServices({
        0x180F: {
          0x2A19: {
            value : [Puck.getBatteryPercentage()]
          }
        }
      });
    }, 60000);
    
    setWatch(function(e) {
      var len = e.time - e.lastTime;
      if(len>0.7)
      {
        controls.playpause();
        digitalPulse(LED1,1,100);
      }
      else if (len > 0.3) {
        controls.prev();
        digitalPulse(LED2,1,100);
      } else {
        controls.next();
        digitalPulse(LED3,1,100);
      }
    }, BTN, { edge:"falling",repeat:true,debounce:50})­;
    

    I think recent phones are always trying to connect to local Bluetooth/BLE devices that have previously been registered and allowed by the user

About