The same code will work.
No need to explicitly advertise on Bluetooth. It will automatically come. Just take care of keeping bluetooth of both devices ON.
There is no explicit setting for bluetooth or Wifi, It will connect devices in whatever possible way they are available.