Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Biju
Level 7

does anybody have the code for linking roku device to websit

does anybody have the code for linking roku device to website for restricting user to view my private channel
0 Kudos
13 REPLIES 13\
joetesta
Level 11

Re: does anybody have the code for linking roku device to we

yes in the example applications that come with the SDK, look for the one called 'register' and merge it into your channel.
aspiring
Biju
Level 7

Re: does anybody have the code for linking roku device to we

"joetesta" wrote:
yes in the example applications that come with the SDK, look for the one called 'register' and merge it into your channel.

How to merge it into my channel im? do you have the sample code for it?
0 Kudos
joetesta
Level 11

Re: does anybody have the code for linking roku device to we

"Biju" wrote:
"joetesta" wrote:
yes in the example applications that come with the SDK, look for the one called 'register' and merge it into your channel.

How to merge it into my channel im? do you have the sample code for it?


the sample code is in the example application. for your custom app you probably have to figure it out or hire someone who can do it.
aspiring
0 Kudos
destruk
Level 10

Re: does anybody have the code for linking roku device to we

Or you could join the roku Premium Developer Program, where roku does all required linking and billing for you without you needing to have it in your app. Their cost is 30% of whatever you charge - last time I checked.
0 Kudos
RokuJoel
Roku Employee
Roku Employee

Re: does anybody have the code for linking roku device to we

Biju, here is a little thing I whipped up this morning which might solve your short-term private channel linking issue. I haven't tested it, but it should work:

On your website, you create a text file of all the serial numbers, each on its own line.
on the roku, In the very top of your channel, in sub main(), put in the following:

sub main()

xfer=createobject("rourltransfer")
xfer.seturl("http://mywebserver.com/serialnumbers.txt") 'the url and path to your file
list=xfer.gettostring().tokenize(chr(10))
di=createobject("rodeviceinfo")
myserial=di.getdeviceuniqueID()
?myserial
linked=false
for each number in list
if number.left(number.instr(chr(13)))=myserial or number=myserial then
linked=true
end if
end for
if linked=false then
dialog=createobject("roonelinedialog")
dialog.settitle("Serial number: "+myserial)
?"my SN=";myserial
dialog.show()
sleep(20000)
dialog.close()
return
end if

end sub

Note that this has only been tested with a text file created by windows Notepad.

So essentially, if someone launches the app and their serial is not in your text file, it will display their serial number for 20 seconds and exit, otherwise, it should continue on to allow them access to your content.
Biju
Level 7

Re: does anybody have the code for linking roku device to we

"RokuJoel" wrote:
Biju, here is a little thing I whipped up this morning which might solve your short-term private channel linking issue. I haven't tested it, but it should work:

On your website, you create a text file of all the serial numbers, each on its own line.
on the roku, In the very top of your channel, in sub main(), put in the following:

sub main()

xfer=createobject("rourltransfer")
xfer.seturl("http://mywebserver.com/serialnumbers.txt") 'the url and path to your file
list=xfer.gettostring().tokenize(chr(10))
di=createobject("rodeviceinfo")
myserial=di.getdeviceuniqueID()
?myserial
linked=false
for each number in list
if number.left(number.instr(chr(13)))=myserial or number=myserial then
linked=true
end if
end for
if linked=false then
dialog=createobject("roonelinedialog")
dialog.settitle("Serial number: "+myserial)
?"my SN=";myserial
dialog.show()
sleep(20000)
dialog.close()
return
end if

end sub

Note that this has only been tested with a text file created by windows Notepad.

So essentially, if someone launches the app and their serial is not in your text file, it will display their serial number for 20 seconds and exit, otherwise, it should continue on to allow them access to your content.

Thank you joel, but i didnt understand in which file on the roku i have to put these codes. is it in appmain.brs or somewhere else?
0 Kudos
RokuJoel
Roku Employee
Roku Employee

Re: does anybody have the code for linking roku device to we

Depends on which sample application you based your project on. If it is the videoplayer example then it would go in appMain.brs, right at the top, immediately after Sub Main()

You have to have the serialnumbers.txt file on your server before you launch the project. It doesn't have to have any content yet, but it needs to be there.

- Joel
Biju
Level 7

Re: does anybody have the code for linking roku device to we

"RokuJoel" wrote:
Depends on which sample application you based your project on. If it is the videoplayer example then it would go in appMain.brs, right at the top, immediately after Sub Main()

You have to have the serialnumbers.txt file on your server before you launch the project. It doesn't have to have any content yet, but it needs to be there.

- Joel

Than you Joel for supporting i'll try this sample. Thank you
0 Kudos
bandal
Level 8

Re: does anybody have the code for linking roku device to we

I can confirm it does work. Thanks