1: It is against Apple’s rule to display quit and close request on iOS. Here is citation from Apple developer’s instruction:
People stop using an app when they switch to another app, return to the Home screen, or put their devices in sleep mode.
2: Using this for other purposes than send signal to save data can be again considered as going against Apple’s conventions because it overrides function of iPhone’s home button.
How to get iPhone’s home button press notification?
func _notification(what):
if what == MainLoop.NOTIFICATION_WM_FOCUS_IN:
print("NOTIFICATION_WM_FOCUS_IN")
elif what == MainLoop.NOTIFICATION_WM_FOCUS_OUT:
print("NOTIFICATION_WM_FOCUS_OUT")