TL;DR: Remove any Oculus app and enable the Gear VR Service developper mode. Do not disable Gear VR Service package.
This step-by-step guide will allow you to plug your device into the Samsung Gear VR HMD without auto-launching Oculus Home and still having the HMD buttons disabled and the USB charger active.
We came to this procedure thanks to this guide. We found some steps not necessary and missed informations so we made this one. Cheers to robamacaf !
Finally, this has been tested and worked on a Samsung Galaxy S7 / Android 6.0.1 with an Apache Cordova app. If you have tested this on another setup and it worked, please notify me and I'll update this guide.