Hello Moosa
Well, we do not know much about your Project, your code does send or receive any data. You are using Bluetooth Classic, I hope you have checked that the device you wish to connect to uses the same.
See the attached. It shows how to play the sound just once. It also shows how to give the attempt to connect a little time (1 second). Usually connection is immediate, but not 100% of the time.
Also, I show the code needed to ensure that the Phone actually has Bluetooth enabled.
Sorry but I'm unavailable now, I am working on a commercial Project.
Right-click on the above Blocks Image to view full size in another Browser Tab.