How do I detect if the user has left my app?

后端 未结 6 1020
情话喂你
情话喂你 2020-12-02 15:36

I am developing an Android app and I want to detect when the user exits my app either by clicking the Back button or the Home button.

Also, an event like onIn

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 16:21

    another option that you might consider is to check for the back button or home key press. This is done by overriding the onKeyDown() , listen for the back key/home key and override the default behaviour.

    I've found a similar question that might help you out.

    Android: Prompt user to save changes when Back button is pressed

    Cheers

提交回复
热议问题