How to ESC and QUIT app on Android?

Monkey Targets Forums/Android/How to ESC and QUIT app on Android?

Virtech(Posted 2011) [#1]
Is there any command available in monkey to quit an app running on an android device? Usually the back button on the phone quits most applications. But with monkey apps, I need to hit the home key and force quit through the phones task manager. Which is annoying.


Xaron(Posted 2011) [#2]
There should be at least something like OnSuspend() or anything else to get notified about an application switch.

Quitting an application could be done via a simple exit button I guess so something you have to implement.


Virtech(Posted 2011) [#3]
Implementing a quit button is no problem. But what command to use that actually quits the monkey app is what I cant find in the documentation. Is there such a command at all?

Edit: Deleted those snippets. No need to confuse the public with non existent commands :)


Xaron(Posted 2011) [#4]
Yes they wont because that OnSuspend was just an enhancement idea. ;)


Virtech(Posted 2011) [#5]
Lol I see :) Being able to quit the app properly is a welcome enhancement :)


Xaron(Posted 2011) [#6]
I have thought about that but still see no way of properly exiting an app on Android. Same is true for iOS as far as I can see...


Virtech(Posted 2011) [#7]
I lack the practical knowledge in this field. But could we teoretically add this functionality ourself as a monkey module?


Xaron(Posted 2011) [#8]
Yes. But you have to implement the native part for this.


Canardian(Posted 2011) [#9]
I found a solution:
http://www.monkeycoder.co.nz/Community/post.php?topic=193&post=1342


Virtech(Posted 2011) [#10]
Didnt realize you could import java files directly like this. Way cool!
So this will not break with future monkey updates?


Canardian(Posted 2011) [#11]
I think it is pretty standard Monkey code, so I don't see any reason why it should break in future Monkey versions.