"RokuMarkn" wrote:
I'm hoping to do a substantial update to the roChannelStore documentation soon. Meanwhile, note that DoUpgrade, like most of the roChannelStore methods, will not work in a side loaded channel. You need to run in a published channel (private is ok). So you must write your code, upload to the store, then download to your unit and test. It's admittedly rather awkward.
--Mark
"buskila" wrote:
Seems straightforward enough. One question though - is there any way to bypass the actual payment? I do want to see that the "trial" channel gets replaced however.
function main() as Void
screen = CreateObject("roParagraphScreen")
msgport = CreateObject("roMessagePort")
screen.SetMessagePort(msgport)
screen.SetTitle("upgrade test")
screen.AddParagraph("calling GetUpgrade")
screen.Show()
store = CreateObject("roChannelStore")
store.SetMessagePort(msgport)
store.GetUpgrade()
items = invalid
while true
msg = wait(8000, msgport)
if msg = invalid then
exit while
elseif type(msg) = "roChannelStoreEvent" then
if msg.IsRequestSucceeded() then
items = msg.GetResponse()
print "got ";items.count();" items"
exit while
elseif msg.IsRequestFailed() then
print "channel store req failed: ";msg.GetStatusMessage()
return
end if
elseif type(msg) = "roParagraphScreenEvent" then
if msg.IsScreenClosed() then return
end if
end while
if items = invalid or items.count() < 1 then return
item = items[0]
facade = screen
screen = CreateObject("roParagraphScreen")
msgport = CreateObject("roMessagePort")
screen.SetMessagePort(msgport)
screen.SetTitle("upgrade test")
screen.AddParagraph("ready to upgrade to " + item.name + " (" + item.code + ")")
screen.AddButton(1, "Upgrade")
screen.Show()
store.SetMessagePort(msgport)
while true
msg = wait(0, msgport)
if type(msg) = "roParagraphScreenEvent" then
if msg.IsScreenClosed() then return
if msg.IsButtonPressed() then
print "starting upgrade"
if store.DoUpgrade() then
print "upgrade succeeded"
else
print "upgrade failed"
end if
end if
end if
end while
end function
We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. You will not be able to log in or post new comments or kudos during this time. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12 and you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
Thanks for your patience — we’re excited to share what’s next!