Hello
I want to show Exit dialog box in my app before user leave the app. To resolve the issue, I have follow below link which has all the necessary steps to show dialog box. But in my case same code is not working.
Link : https://medium.com/@amitdogra70512/confirmation-dialog-on-app-exit-in-roku-b305d91acec8
In my case, dialog box is not getting display and app close directly without waiting for dialog box.
Any suggestions and help are welcome.
Thank you.
The code provided in the medium blog link seems fine.
Share what you have done to get help.
I have used same code. There is no difference in my code for Exit dialog box.
I suggest you add print statements to the code to figure out what's going on. I suspect the key press isn't getting to the onKeyEvent function in MainScene.brs. For example, add:
print key,press
at the beginning of the onKeyEvent function and:
print msgType
in the event loop. If you never see "back true" on the debug console you'll know the remote button press never made it to onKeyEvent.
I've found peppering my code with prints is the best way to figure out what SceneGraph is doing.
Note, this will only catch a user hitting the back button to exit from your main screen. There's no way to intercept using the home button to return to home screen or using a partner button to launch another channel.
Thanks for the reply. in my code, onKeyEvent get executed but i have added the condition
if press and key = "back" then
Code inside this condition is not getting executed.