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: 

How to implement persistent cookie in brightscript

How can we implement persistent cookie in brightscript ? 

Situation: We have a timer running and a request is sent to server every n seconds  (So a task is fired every n seconds)

inside task i used createObject("roUrlTransfer")
As far as my experience goes with brightscript, it cannot store the state of object , So every time a task is created , a new object is created and a new cookie is generated .
The server box is creating new cookie everytime i create a new roUrlTransfer object.  

So to make sure roUrlTransfer is created only once , i have called task RUN method only once and have implemented a observer for request payload.   Every time payload changes new request is sent using same object. 

But now when i close the app and open,  it cannot maintain the state of object .. So new cookie is generated again.  How can we prevent this ..  

I want to use same cookie until it is expired even in below four cases

app closed and reopened
app updated
app switching between background and foreground
switching between different streams 

Is there a way we can do This. 

can i use set-cookie header to use same cookie everytime
does roRegistry help me in handling persistent cookies..

0 Kudos
2 REPLIES 2
squirreltown
Roku Guru

Re: How can we implement persistent cookie in brightscript

"asrikanth1990" wrote:
HI 
How can we implement persistent cookie in brightscript. 

does roRegistry help me in handling persistent cookies..


You can store any string you want in the registry and it will persist between app restarts.

Kinetics Screensavers
0 Kudos

Re: How can we implement persistent cookie in brightscript

"squirreltown" wrote:
"asrikanth1990" wrote:
HI 
How can we implement persistent cookie in brightscript. 

does roRegistry help me in handling persistent cookies..

You can store any string you want in the registry and it will persist between app restarts.


Thanks mate for the response. 
I guess registry is the only choice i have given the limitations of roku file system.

0 Kudos