App Pausing (android)

Previous topic - Next topic

MrPlow

Hi Guys,

I am having problem with my app pausing for android...
When lost focus does the function glb_on_pause fire right away or when I re-focus to it?
My code seem to continue moving objects.

Thks!
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

kanonet

GLB_ON_PAUSE should get called right at the moment when you lose focus and GLB_ON_RESUME gets called when you resume the app. At least thats how it should work.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

spacefractal

It's a area that not working very good in android API 8 at all. Android is pretty odd here.

Back button quit the app and pause might not resume correctly when return.

Hopefully it's fixed in the later version of sdk. So I'm reimplemented that again for androidextras (and back button can also been disabled to prevent a quit in ingame).

It's works quite better that way...
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Sounds good ... Spacefractal
Is it easy to implement with Androidextras?

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

back can been enabled and disable by a function, see Android Sample.

EnableBackButton(TRUE) enable BACK (but seen altso its also enable OnPause() and OnResume() subs while EnableBackButton(FALSE) disable both.

That was the best comprimise im could give for a work around in Java.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

erico

If I then use enable back button false, what would happen lets say, if the phone rings? would it kill the ongoing game?

My problem with the back button is that I would like the game controls on possible 2 selectable positions, top sides and down sides.
If you phone is big, like a noteII, it is more confortable to have them on top, like a caanoo for example.
If your phone is small, it is better to have them on bottom, like those ancient lcd games.

If controls are on top, you can easily hit the back button for instant exit :O

I´m now noticing that on android 4.3, if you push the top border even on a glb game, you bring down that setting bar.
This wasen´t happening on my last 4.2. Is there a way to disable that too on android extras?

I think I will keep the back button and lock the controls on the lower part of the screen. While on top it is more confortable on big phones, it is not a deal breaker at all, it just feels more confortable (at least for me, haven´t checked with others).

spacefractal

#6
Yes the BACK button for quit is a very annoying Android behaiver, when you not consume that on Java part (which is nice for Apps, but not in Games). Its harder to checks that for c++ code. Here its very wierd.

Also Glbasic have seen quite soon Pause() or an another Intent was invoking (without possible control from Java when its should happens), which was very annoying glbasic bug, which should not do that. howover that might have fixed in v12, so im relook on that again soon.

By now, when BACK is disabled, then PAUSE/RESUME cannot been detected, so the app will not close down on a phone call, but the game will countinue to been played in the background my guess, so you property will die very quickly. The java should detect a phone call, so a Pause() event can been sent here. Its should been possible to do that.

EDIT: This was not a glbasic bug, but more that way Android works, but im do have ideas. That due when OnPause() is invoked then OnDestroy() would been called after that. That why glbasic closed down on pause.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

Did you try allowescape true?

Gesendet von meinem GT-N7100 mit Tapatalk


MrPlow

Allow escape seems to work for me...
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

erico

oh my! I will give that a try soonish! :)

spacefractal

funny here, im uses ALLOWESCAPE FALSE (im have not liked ESCAPE quit the game directly on Windows), and its still works at least with AndroidExtras. Im did partically fixed the BACK issue, so its pause the game and launch the default launcher when EnableBackButton(FALSE) and the direct quit on EnableBackButton(TRUE). Thinks its works better. In next version, im should add a confirm box when pressed on that.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

erico

Tried allowescape false on glb v10 and 12 for android and it still quits app with the back button.
I´m still getting "lottery" app stops working when running on android 4.3, I can´t seem to find the reason for that but since I´m back home there will be some time to study that. Strange it always worked fine on android 4.2 and bellow.

spacefractal

#12
before im can see if its AndroidExtras, you should look on _logview.bat to checkout its log (which should tell a long crash log when its happens). Then its will tell why it crash, if its a Java thing.

On Android v1.6.1, the back button will now quit normally, but if you do a EnableBackButton(FALSE), the app will launch the launcer instead, but does not quit. Later im should add a confirm box when back button is pressed. The Quit part is not handled by glbasic really, but in SDLActivity.Java do that.

anyway glbasic also have orientation issue, which might not still have fixed in v12, but this can fix that:

Code (glbasic) Select

IF PLATFORMINFO$("DEVICE")="TOUCHSCREEN" OR PLATFORMINFO$("DEVICE")="KEYBOARD"
LOCAL ORIENTATION=getScreenOrientation()
    SETORIENTATION ORIENTATION
ENDIF
[code=glbasic]

or do a EXTRASSTARTUP()
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/