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.
The text was updated successfully, but these errors were encountered:
ntop001
changed the title
gomobile lifecycle.StageDead never reach on Android
x/mobile: lifecycle.StageDead never reach on Android
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
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.The text was updated successfully, but these errors were encountered: