Detect Headset Button Press

Hello guys . Is it possible to bind function to headset buttons (Android) ? For example dbl click or single or maybe volume keys .

The headset click is originally a play and stop button for music. Although it would be nice for a phone to add a custom button for this. I do not believe there is a button configured for this giving it is programmed for a specific application and not to interfere with other applications.

@SooGreedy In my android cellphone I used the code “f7” to access the headset button but I’m not sure if it works to every headset in every cellphonr

@Frota_lv could you explain the way you use code "f7 to access headset button by script