Not Exiting app with OnBack

Pierrou

Well-known member
Joined
Jul 6, 2017
Messages
236
Hi,
I'm doing an app for smartphones (Android at the moment, iOS when I can use someone's Mac) and usually on those platforms when using the any app's Back button, the app disappears and one gets back to the phone's "desktop" but it's not closed and one can then get back to it.
I'm using fantomCX and at the moment the only way to do something close to this is to use fE.ExitApp() but when using it the app starts over again when one goes back to it. Is there another way to use the OnBack method to go back to the desktop without closing the app so that one can resume it?
Thanks!
 
Last edited:

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,284
I'm not 100% sure but I think you need to use the general exit command which is
Error(""). Android is not supposed to exit (only resume) and neither is HTML, so that is why it is called error and you can give it a message or just leave.
 

Pierrou

Well-known member
Joined
Jul 6, 2017
Messages
236
Thanks Jimmy, using Error("") leads to the same result, my app starts over again when selected.
 

Pierrou

Well-known member
Joined
Jul 6, 2017
Messages
236
Thanks! I don't quite get why I would put it inside OnUpdate? I was wondering if there was some Function/Method somewhere I had been missing but if that's not the case nevermind.
 

MikeHart

Administrator
CX Code Contributor
3rd Party Module Dev
3rd Party Target Dev
3rd Party Tool Dev
Joined
Jun 19, 2017
Messages
3,504
Exiting the app is collected as a Crash these days with Apple and Google and will give you worse search results when it accumulates to much. So I would advice against this. Let you user close/exist the app like he/she/it is surpose to do via the operating system.

I think Jimmy reported once that the OnBack method isn't called when the app is closed. I still need to look into this.
 

Pierrou

Well-known member
Joined
Jul 6, 2017
Messages
236
So I shouldn't use fE.ExitApp at all? And shouldn't use the OnBack button to temporarily go back to desktop for now?
Thanks Mike!
 

MikeHart

Administrator
CX Code Contributor
3rd Party Module Dev
3rd Party Target Dev
3rd Party Tool Dev
Joined
Jun 19, 2017
Messages
3,504
So I shouldn't use fE.ExitApp at all?

On Mobile, not. As it causes a crash of the app. You can use the Back button, but I think it has no effect regarding the call of OnBack/OnClose on Android. Something seems to be off here, when we read other users posts on this Forum. I didn't try myself, so I have to look into this more closely.
 

Pierrou

Well-known member
Joined
Jul 6, 2017
Messages
236
OK I'll be using OnBack for in-app navigation only then, thanks!
 
Top Bottom