You can use these functions on your project.
Android.closeGame() // Closes the app

Android.showToast("Hello!") // Displays a toast

Android.fileSet('filename', 'content') // Save a file
Android.fileGet('filename') // Read a file
Android.fileDel('filename') // Delete a file
Android.fileExist('filename') // Test if a file exists
Android.fileSize('filename') // The file's size
Android.fileList() // List all the files

Android.requestNotifications() // Request permission to use notifications
Android.notification("Title", "Content") // Create a basic notification
And declare this function to handle the back event
function onBackPressed() {
    // Define what happens here
}

Check my stuff on niupleis.com