Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
FML2010
Visitor

send token on http post <solved> Thanks Chris!

i have tried everything to do this but im not having any luck here!!

what have I done wrong in this code below? it wont even load the app in my box when adding this and i cant figure out what i have done wrong, i have used the regScreen as a template to do this


'***************************************************************
' Check user is paid or not and update registry
'***************************************************************

Function checkUserType(token As String) As String

token = RegRead("RegToken", "Authentication")

m.UrlBase = "http://XXXXXX.net/roku"
m.UrlGetUserInfo = m.UrlBase + "/accounts.php"

http = NewHttp(m.UrlGetUserInfo)
http.AddParam(" token", token)

while true
rsp = http.Http.GetToString()
xml = CreateObject("roXMLElement")
if not xml.Parse(rsp) then
print "Can't parse check User status"
ShowConnectionFailed()
return 2
endif

if xml.GetName() <> "result" then
print "unexpected check user status response: ", xml.GetName()
ShowConnectionFailed()
return 2
endif


if islist(xml.GetBody()) = true then
for each e in xml.GetBody()
if e.GetName() = "type" then
userType = e.GetBody()
RegWrite( "userType", userType)
else
return 3
endif
next
endif
end while

End Function



also is it possible to add this to the appDetailsScreen , or maybe appHomeScreen so that it checks on another page outside the regScreen?
0 Kudos
8 REPLIES 8
RokuChris
Roku Employee
Roku Employee

Re: send token on http post

Returning an integer from a function whose return type is a string is one problem I see right off. What kind of output are you seeing on the debug console?
0 Kudos
FML2010
Visitor

Re: send token on http post

Chris your gonna love this response!!!

What do you mean debug console??

i am using notepad and my roku as testing nothing else!
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: send token on http post

From section 8 of RokuDvp-DeveloperGuide.pdf
"RokuDvp-DeveloperGuide.pdf" wrote:
Using a standard shell program and a telnet client application, you can connect to the console for your application. The console provides you a window into the runtime environment for your application.


To access the debug console telnet to port 8085 on your box.
0 Kudos
FML2010
Visitor

Re: send token on http post

all i can say is WOW!!!!!

weeks of posting on here and didnt know this!! Chris you have been very helpful!!
0 Kudos
EngoTom
Visitor

Re: send token on http post <solved> Thanks Chris!

Using the debug console and the Print statement is your friend when debugging for sure! The Stack Trace is also very helpful when you throw errors.

Question for ROKU. Does the Print statement affect performance? Should Print statements be commented out for a production build/release?

THX
0 Kudos
TheEndless
Channel Surfer

Re: send token on http post

"FML2010" wrote:
all i can say is WOW!!!!!

weeks of posting on here and didnt know this!! Chris you have been very helpful!!

If you haven't already, you should probably read through the RokuDvp-DeveloperGuide.pdf that's included with the SDK. Section 8.0 covers debugging...
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
FML2010
Visitor

Re: send token on http post <solved> Thanks Chris!

Reading ALL those docs are a huge task!!

Everyone refers to them but sometimes they arent easy to understand and its easy to miss something or pass right over it.

so far the telnet has helped me a ton!! i have a laptop and a desktop on my desk so i can debug on one while working on the other and watching on the Tv
0 Kudos
RokuKevin
Visitor

Re: send token on http post <solved> Thanks Chris!

Yes. print statements can affect performance.

It's usually not noticeable for error conditions you'd like to keep track of when debugging your app, so no need to comment those out.

But if you are printing out every URL in your content list, those hundreds or thousands of print statements may very well lead to a slowdown that your users notice.

--Kevin
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.