brightscript

How to prevent the user from exiting the channel during splash screen


I am a beginner Roku developer.

I have removed the splash screen from the manifest and created a separate component that has an animation and serves as a splash screen before proceeding to the channel UI. My task is OK but I have to make it impossible for the user to get out of the channel with the back button.

I thought to do it with onKeyEvent but don't know what to make it do when the user presses the back button...

function onKeyEvent(key as string, press as boolean) as boolean
    handeled = false
    if press then
        if (key = "back") then

        end if
    end if
end function

Solution

  • All You need to make it impossible for the user to get out of the channel with the back button is a handle back press on the tree root, in the scene script. Just like you described.

    'inside scene.brs
    function onKeyEvent(key as string, press as boolean) as boolean
        handled = false
        if press
            if (key = "back")
                handled = true
            end if
        end if
        return handled
    end function