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

51 Views Asked by At

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
2

There are 2 best solutions below

1
hornyhedgehog On BEST ANSWER

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 
1
Vlatko Golovrški On
function onKeyEvent(key as string, press as boolean) as boolean
handled = false
if press then
    if (key = "back") then
        handled = true
    end if
end if
return handled

end function