golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.36k stars 17.58k forks source link

x/mobile/app: lifecycle events not firing correctly #13207

Open BrianCraig opened 8 years ago

BrianCraig commented 8 years ago

Hi ! Im having some issues related to lifecycle event. The problem is that, i want to know when an App wants to Quit, but i don't get the corrects events

the gist is here : https://gist.github.com/BrianCraig/bb2bb411a202b35c1a88

First, im gonna run it on my PC (x86 AMD - default linux mint 17 Quiana cinnamon distro)

start the process

StageDead none StageAlive on StageVisible on StageFocused on

this is a correct event, which says that the stage is created (alive), visible, and focused

paint internal

now this paint is internal, but, it should be external; there is not a single paint event sent in my code

minimizes window

nothing happens

close button window

nothing happens

log out session

nothing happens

Then, im gonna run it on my phone (Android 4.4.2 - Moto E first gen)

start the process

StageDead none StageAlive on StageVisible on StageFocused on

this is a correct event, same for pc

paint external

correct context

minimizes app

StageDead none StageAlive none StageVisible off StageFocused off

correct event

opens view

StageDead none StageAlive none StageVisible on StageFocused on

correct event

minimizes app again

StageDead none StageAlive none StageVisible off StageFocused off

correct event

closes the app

nothing

So, is this working right ?

BrianCraig commented 8 years ago

Update:

Here https://github.com/golang/mobile/blob/master/app/android.go i found that, for android, there are binded events like onStart() onStop() onPause() and onResume() that are not triggering anything;For example, i imagine that onStop() should trigger a StageAlive off event.

rakyll commented 8 years ago

/cc @crawshaw

db47h commented 8 years ago

For the X11 part, there is no lifecycle event received on close because of issue #12828. This probably applies to session log out too. Minimize is also not handled at all right now.