Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Storing global/application variables

Hi all,

I've managed to get the xAuth authentication working for Twitter. I retrieve the oauth_token and oauth_secret_token which I can then use for future Twitter functions in my app.

What I want to do is to store these two token's in an application variable or global variable so I can call on them from functions that I'll build.

Could someone advise how I'd store these and then retrieve them.

I've tried Ti.App.token = 'tokenvalue'; but didn't seem to work.

Hope you can help

Paul

— asked August 10th 2010 by Paul Pounder
  • application
  • global
0 Comments

3 Answers

  • Accepted Answer

    Hi, this could give you some ideas

    http://developer.appcelerator.com/blog/2010/06/how-to-persist-complex-javascript-objects.html

    — answered August 10th 2010 by Dan Tamas
    permalink
    0 Comments
  • Ti.App.token should work, I use it in my apps.

    What do you get if you do Ti.API.info(Ti.App.token) somewhere else in you app?

    You could also use Titanium.App.Properties that can also save the token between sessions if that is wanted.

    If you want more help, I'll need to see the code.

    — answered August 10th 2010 by Sindre Sorhus
    permalink
    0 Comments
  • Cheers Tamas and Sindre. Both answers just what I needed, and I have it working.

    — answered August 10th 2010 by Paul Pounder
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.