Check if app used

Is there a way to know if any aspect of the app is touched, for example, a button is pressed on any form on the app?
I would like to record the last time there was any activity on the app then turn of bluetooth after a certain time.

Thanks