Posted: 12th Feb 2021 13:29
Hello,

When I quit my app on Android everything looks ok, but in the background the app stays open with a black screen (see attached file) and I have to manually close it otherwise the app refuses to restart.

to close app i use :
+ Code Snippet
DeleteEditBox(textinput) 
DeleteAllSprites()
DeleteAllImages()
DeleteAllObjects()
DeleteAllText()
end
Posted: 12th Feb 2021 22:48
Try this pseudocode
+ Code Snippet
mainloop //has to be in main and the default do loop location not a function you called
repeat
      callgamefunction()
until exitstat=true
end

gamefunction()
endfunction exitstat
Posted: 12th Feb 2021 23:18
I think they do that because when they terminated the app they were getting an app crashed alert which downgraded the app on the play store.
I have a lot of apps on my phone and i don't think ANY of them actually terminate
Posted: 13th Feb 2021 14:26
I think it's assumed that on mobile devices, you terminate apps from the multitasking pane. If your app is going to run both on mobile and desktop, you can simply check which platform it's currently running on and offer a quit function for desktop only.
Posted: 20th Feb 2021 18:47
I also put same post on Studio forum ..
Paul answer me as below =
AGK used to force the app to quit when you used the end command on Android, however the Google Play store started counting this as a crash and scoring the app negatively if it had too many crashes. So now the end command will send the app to the background to keep Google Play happy.


https://forum.thegamecreators.com/thread/227018
Posted: 20th Feb 2021 19:22
"End" is also the last command of any AppGameKit program.
https://github.com/TheGameCreators/AGKTier2/blob/master/apps/interpreter/ProgramData.cpp#L886
So simply reaching the end of byte code will do the same thing as calling End.

When AppGameKit changed a couple of updates ago, I had to change my programs to call MinimizeApp() at the end and loop back to the top.
Posted: 21st Feb 2021 19:04
Try MinimizeApp() instead of using End

That should fix the problem


PSY
Posted: 21st Feb 2021 20:35
@PSY: If I remember correctly, only calling MinimizeApp at the end requires the user force close the app in order to restart it. The last instruction in the bytecode is always "end".
Posted: 21st Feb 2021 22:41
This works fine too...

+ Code Snippet
ClearScreen()
Print "This app is permanent now. Should've thought of that before running it. Time for a new phone."
Posted: 22nd Feb 2021 2:16
@adambiser
Sorry, for some reason I didn't realize you mentioned MinimizeApp() in your post before mine.
Thanks for the info
Gonna run some tests on this.

@n00bstar
LOL

PSY
Posted: 22nd Feb 2021 4:10
@PSY: MinimizeApp and loop back to the beginning or the user has to force close the app manually.

But all of this feels like a workaround for a problem in the engine. Why doesn't AppGameKit handle the END statement better on Android?
Posted: 22nd Feb 2021 6:19
I think it's the way apps are on mobile devices as opposed to an END statement problem.
Mobile device apps simply do not end.
I have a ton of apps on my android device and absolutely NONE of them have an exit button...none i tells ya!!
Posted: 22nd Feb 2021 6:49
@blink0k: Which is why I think that END should be handled better for mobile than it is since END isn't really something for mobile apps. It makes more since for END to minimize the app and put it back into the beginning state.