Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: lifecycle.StageDead never reach on Android #26959

Open
ntop001 opened this issue Aug 13, 2018 · 0 comments
Open

x/mobile: lifecycle.StageDead never reach on Android #26959

ntop001 opened this issue Aug 13, 2018 · 0 comments
Labels
mobile Android, iOS, and x/mobile
Milestone

Comments

@ntop001
Copy link

ntop001 commented Aug 13, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8.1 darwin/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/Users/ntop/tools/go"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ntop/workspace/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/t6/8417qy4n2zn3lb370499nrl00000gn/T/go-build741486693=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

Add following code in the basic example

for e := range a.Events() {
			switch e := a.Filter(e).(type) {
			case lifecycle.Event:
				switch e.Crosses(lifecycle.StageAlive) {
				case lifecycle.CrossOn:
					log.Println("==========application create")
				case lifecycle.CrossOff:
					log.Println("==========application destroy")
				}

What did you expect to see?

Both "==========application create" and "==========application destroy" should be printed.

What did you see instead?

I see only "==========application create" printed.

According to the documentation at lifecycle.go, StageAlive: On Android, these correspond to onCreate and onDestroy. So e.Crosses(lifecycle.StageAlive) == lifecycle.CrossOff will be true when Activity.Destroy() is Called. But it just did not happen. I have read the code of 'android.go', it did't implement the onDestroy() method, and did not send any lifecycle.StageDead message.

@ntop001 ntop001 changed the title gomobile lifecycle.StageDead never reach on Android x/mobile: lifecycle.StageDead never reach on Android Aug 13, 2018
@gopherbot gopherbot added this to the Unreleased milestone Aug 13, 2018
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Aug 13, 2018
ntop001 added a commit to KorokEngine/mobile that referenced this issue Sep 13, 2018
ntop001 added a commit to KorokEngine/mobile that referenced this issue Sep 13, 2018
ntop001 added a commit to KorokEngine/mobile that referenced this issue Sep 28, 2018
andydotxyz pushed a commit to fyne-io/mobile that referenced this issue Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

2 participants