[Android back button] Android Back button event not working
Forge component by Miguel Vicente
Application Type

Hi All,

Problem Statement :

when I opened an mobile application and then press back button of android device but back button event is not triggered and application got closed. but when we navigate to other pages in menu and come back to dashboard then press back button after that event is triggered

Requirement :

Need confirmation popup to exit application.

I have already implemented logic for exit application on users confirmation but it not works on first time application opened. it works when we navigate to other pages and come back to dashboard of the application.

Here is the flow details.

I am using outsystems android back button event in layout block.

Here is the settings on my dashboard page.

Hi Swapnil,

Have you tried the Exit on back plugin?


Hi Alvaro Pinilla Pedroche,

I tried Exit app plugin but this plugin don't have functionality to confirm popup message for before exit app by user. 

Hi Swapnil Shinde

I hope it finds you well. 

In our recent version, there is an issue related to Exit on Android back. Please download Version 1.0.0 and it will just work fine. We hope to solve the issue as soon as possible. 

Thank you for your feedback! Much appreciated! 

Kind Regards 

Hi Swapnil Shinde

We just have added a new version that solves the problem.

Please check our demo that is attached to the download.

Thank you!

Hi Miguel Vicente,

Thank you for reply.

I have updated plugin to latest version but issue is still persist.

For the first time when i open an application and the press back button then without confirmation popup i exit the application.

Confirmation popup logic is implemented on android back button event. But i think for the first time this event is not triggered and application got exit.

Hi Swapnil,

Could you please share with us a sample? It will be great to help us to better understand the use case and be fast to solve the issue as soon as possible.

Thank you once again! 


PFA oap file.

Here the link of .apk file



1. Open app - > See home screen -> press android back button

2.Open app - > See home screen - > click on contact us - > see contact us screen -> click on home -> press back button -> popup shows



Yes you are right, with your use case we have to do it in a different way. The reason why is because the event is attached to the scope and the popup is in the same scope that you have used to call the Popup. 

I'm checking if we could have a client action that overrides the scope after opening the popup.

I'm doing some tests and I will let you know as soon as I found a solution.

PS: it is a good pattern btw ;) 

Thank you! 

Hi again,

Please try to run on your "Yes" client action the following javascript.


Please let me know if it works. I have tested in my sample and it works just perfect.

Thank you,

Kind Regards

Hi Miguel Vicente,

Thank you for appreciation.

But I am facing issue with scenario one. 

If you see in scenario one confirmation popup is not executed after press android back button and app is exit.(expected o/p : Must shows the confirmation popup when click on android back button )

And same if you check in scenario if on home screen and then go to the contact us screen and come back to home screen and then press  the android back button then confirmation pop is executed and ask for exit app Yes or No.

If press yes then exit js executed and press no then confirmation pop up will close and user will stay on the page

Business Requirement : When user click an android back button from home screen to exit app before that user must see the confirmation message then user will decide exit app Yes or No.

Same ticket i have raised with the outsystems and ask them to check  weather there is code behind that which executes before android back button event triggered.

Thank You !

Hi Swapnil Shinde

I was now able to replicate the issue. It seems like the first time you enter in the app and click on the back button without clicking in anything else it doesn't show the popup. I have created a sample to help you also to test and see the changes available here.

I'm looking for solutions to overcome this issue. I will let you know as soon as I have a solution.

Thank you,

Kind Regards

Hi Swapnil Shinde,

I'm sorry for the late reply but I didn't had time yet to solve the issue I hope to have some news in the end of this week.

Thank you for your patience and sorry for the trouble.

Kind Regards,  


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.