I am just getting started with deep linking and having a hard time with it. I have figured out how to set up a deep link to go to the poster page for a specific show.
The problem is that when I get to the poster page via the deep link, when the user presses the back button on their remote, no message is sent and the channel closes entirely.
If I go to the same page via normal navigation, starting on my channel home page, I can detect a message using this test:
msg.isScreenClosed()
Works totally fine other than when I skip the normal UI and deep link directly to the poster screen for a show.
Can't figure out what is going on. Prior to the poster screen loading, no other screens or dialogs are being loading.
I initialize the screen like this:
Function preShowSeasonScreen(breadA as String, breadB as String) As Object
if validateParam(breadA, "roString", "preShowSeasonScreen", true) = false and validateParam(breadA, "String", "preShowSeasonScreen", true) = false return -1
if validateParam(breadA, "roString", "preShowSeasonScreen", true) = false and validateParam(breadA, "String", "preShowSeasonScreen", true) = false return -1
port=CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
if breadA<>invalid and breadB<>invalid then
screen.SetBreadcrumbText(breadA, breadB)
end if
screen.SetListStyle("arced-16x9")
screen.setAdDisplayMode("scale-to-fit")
return screen
End Function
Then I call the screen like this:
Function showSeasonScreen(screen As Object, SeasonDetails as Object) As Integer
print "================function showSeasonScreen======================"
if validateParam(screen, "roPosterScreen", "showSeasonScreen") = false return -1
m.curCategory = 0
m.curShow = 0
print "set category names for seasons"
screen.SetListNames(getSeasonList(SeasonDetails))
'get classes for season at the current category index
classes = getContentForSeason(SeasonDetails, 0)
screen.SetContentList(classes)
print "display the show screen"
screen.Show()
print "screen is displayed"
while true
print "wait for message"
msg = wait(0, screen.GetMessagePort())
print "message received of type: " + AnyToString(type(msg))
if type(msg) = "roPosterScreenEvent" then
print "showPosterScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
m.curCategory = msg.GetIndex()
m.curShow = 0
screen.SetFocusedListItem(m.curShow)
classes = getContentForSeason(SeasonDetails, m.curCategory)
screen.SetContentList(classes)
print "list focused | current category = "; m.curCategory
else if msg.isListItemSelected() then
m.curShow = msg.GetIndex()
print "list item selected | current show index = "; m.curShow
contentId = classes[m.curShow].ContentId
contentType = classes[m.curShow].contentType
print "content id: " ; contentId
showName = seasonDetails[0].showName
seasonName = seasonDetails[0].seasonNames[m.curCategory]
m.curShow = displayContentDetailScreenFromSeason("", "", m.curShow, classes)
screen.SetFocusedListItem(m.curShow)
print "list item updated | new show index = "; m.curShow
else if msg.isScreenClosed() then
print "screen is closed!"
return -1
end if
end If
end while
End Function
So it the waiting part, I expect the msg.isScreenClosed() event, but it doens't happen via deep link. Using the same exact code and the normal navigation, it works.
One thing I tried is putting a screen in the stack below this (just a blank loading screen) with the thought that having nothing below my screen in the stack might be causing an issue, but that doesn't work at all.
All the navigation works totally fine, and I get the expected messages from all button clicks other than the back button. Help would be much appreciated as I'm stumped.