ASHLEY. Please, would it be possible to implement the application quit control/back button API for CocoonJS in the CocoonJS plugin?
Control over what the back button does is quite important for a consistent user experience in Android.
From Ludei's blog (http://blog.ludei.com/):
"Application ?quit? control
In Android (not in iOS) the back button can be used to destroy the activity. Now, there is a way to control this behavior from JavaScript. The default behavior has changed and now, if the developer does not specify anything, CocoonJS will prompt a dialog and pause the application to let the user decide if the app should be destroyed or not. Moreover, the developer now has the possibility of specifying that he/she wants to take control of the app finalization. The process is as easy as specifying a function that will return a boolean by calling
CocoonJS.App.setAppShouldFinishCallback(FUNCTION_THAT_RETURNS_A_BOOLEAN)
.
If the function returns true, it means the app should finish and if it returns false, it means it should not finish and that the developer takes control of the finalization. Whenever a developer wants to finish the application, there is a function called
CocoonJS.App.forceToFinish
This feature is specially useful in Android (in iOS for example none of the functions will work)."
It would be nice to have the condition:
"On Back Button Pressed"
- so we cab specify what it does.
and the action:
"Close Application"
Control over this would give us massive boost in terms of how professional our apps look compared to the stock Android "Are you sure you want to exit?" dialogue box.
Thanks