John
John

Reputation: 13

Storing data in mobile (JIL/W3C) widgets

How can I store data in a mobile widget (JIL/W3C). Is Widget.setPreferenceForKey() the only option?

Upvotes: 1

Views: 167

Answers (3)

Jens Arps
Jens Arps

Reputation: 11

Yes, what Radu sais, it's the only option, if you want to persist the data. Keep in mind, though, that it's a key/value store and that keys and values are strings. To store objects, you'd need to convert them to/from JSON.

Documentation sadly is rare on this, but this is a good point to start: Opera dev

Upvotes: 1

Tosa
Tosa

Reputation: 658

Not really different to Radu's solution, but it allows you to store data in a persistent way. So your widget can store data on many different devices and in the browser.

You can read about it here: http://tinyhippos.com/2010/04/11/mobile-widgets-persistence-cross-platform-wrapper/

Hope it helps.

Upvotes: 2

Radu Cojocaru
Radu Cojocaru

Reputation: 86

You can store small-size data using Widget.setPreferenceForKey() method and retrieve it with Widget.preferenceForKey(). There are no other options at this moment.

Upvotes: 2

Related Questions