Skip to content

Is there a way to catch onBackPressed and onAppBackgrouded for Android #3557

Answered by Jacalz
gr4c2-2000 asked this question in Q&A
Discussion options

You must be logged in to vote

For onBackPressed there seems to be an open issue about something similar at #2910. It is not currently implemented unfortunately.

As for onAppBackgrouded, I think you should be able to use the Lifecycle API to achieve something similar. You would then use app.Lifecycle().SetOnExitedForeground(func()) to set a function to run as the application exits the foreground. The fyne_demo application has some examples of the API: https://github.com/fyne-io/fyne/blob/master/cmd/fyne_demo/main.go#L70-L83. I believe this should do what you are looking for.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gr4c2-2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
OS:Android Tickets affecting only Android devices
2 participants