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.
“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
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.
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.
In the developer web site, go to “Manage Test Users” and add the account you’re using. Test user accounts can purchase your upgrade but won’t be charged for it. Note that currently a given account can only make a purchase once. There’s no way to “unbuy” the product after you’ve bought it.
Ok, I’ve just done an upgrade and it works but there are few things to watch for. Both the pre-upgrade channel and the upgrade channel must come from the Channel Store (not sideloaded). For testing, both channels must be private channels, and both must be free, since a paid channel doesn’t get into the store until approved. You can call roChannelStore.GetUpgrade() to verify that the store knows you have an upgrade. This returns an array containing one AA which contains info about the upgrade.
Here is the complete source of the pre-upgrade app I used.
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
Also, this is probably obvious but I should mention it – the pre-upgrade channel must list the upgrade channel as its “In-Channel Upgrade” in the properties when the channel is created.
Apologies for the troubles, but its still not working
I have even created a test channel which only has the code you pasted above. The code is half working when side loaded (prints out “Order Failed” - i guess because its side loaded), but when trying to download the channel, during installation it says “downloaded but could not be installed”
Just wanted to expand on this a little to make sure it is clear.
An In-Channel upgrade requires that both the pre-upgrade channel and the upgrade channel be published channels. A free private channel is published as soon as you upload it to the channel store. However a private channel with a fee, or a public channel (with or without a fee), will not be published when they are uploaded, but require Roku approval first (they remain in the “publishing” state until that happens). Therefore to test In-Channel upgrade, you should make both channels free private channels. After your testing is complete, then you can change to a public or paid private channel.
“RokuMarkn” wrote:
Just wanted to expand on this a little to make sure it is clear.
An In-Channel upgrade requires that both the pre-upgrade channel and the upgrade channel be published channels. A free private channel is published as soon as you upload it to the channel store. However a private channel with a fee, or a public channel (with or without a fee), will not be published when they are uploaded, but require Roku approval first (they remain in the “publishing” state until that happens). Therefore to test In-Channel upgrade, you should make both channels free private channels. After your testing is complete, then you can change to a public or paid private channel.
–Mark
So what needs to be done in order for a private channel to get published? One of my private non-free channels have been in the “publishing” state for a while now.