I see this link guide to show exit dialog correct, maybe your code is wrong
you need to put dialog in MainScene.brs and check key back press.
please check: