Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 

Persistent cookie

HI 
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 everytime 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.   Everytime 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
squirreltown
Level 9

Re: Persistent cookie

"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: Persistent cookie

"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