Here's two videos that describe how to get BLE to work on the ESP32 using the Arduino environment.
https://www.youtube.com/watch?v=2mePPqiocUE
https://www.youtube.com/watch?v=osneajf7Xkg&t=1s
There are many useful links in the comments to the videos.
The code is here:
https://github.com/SensorsIot/Bluetooth ... rduino-IDE
This is an incredibly detailed Instructable on getting a BLE application going:
http://www.instructables.com/id/ESP32-B ... E-AWESOME/