This tutorial (actually this capx file) shows you a way to open an "On Exit" message.
So if the player accidentally press the exit button (or the Back Button of the device) he must confirm the exit before the game will be closed.
Android Demo: https://play.google.com/store/apps/details?id=com.ciotemplate.shatter
It will look like that.
In order to open the project you must install the Cocoon CanvasPlus plugin. You can download it for free here.
GitHub - Cocoon C2 Plugins
Please download the attached capx file. There you find a simple code for an "On Exit" message.
Download: Cocoon - On Exit Message
Please, the file is for learning purposes only. If you want to use it in a final game, please purchase a license for 3$ from the Scirra Store. Thank you!