2

I'm currently developing an app using PhoneGap. What I currently have is my app pulls info from online, such as tweets from a certain user account, and displays a feed on one of the pages.

I want to have this page available for offline use if the user is not connected to the Internet, but it would update the twitter feed the next time they're connected. What would be the best method to achieve this functionality?

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
msafi
  • 377
  • 1
  • 5
  • 19
  • This will probably get closed soon, as it's too broad, among other things (*see [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask)*). Meantime: think about it offline-first. You're displaying a locally-stored list of tweets (or whatever) - maybe in SQLite, maybe Local Storage. Also, when you're online, you can update that locally-stored data via Ajax calls, etc. The key is that you're *always* displaying local data; no duplicate code for offline vs. online usage. Only the "update" part cares whether or not you can access the internet. – Paul Roub Jun 08 '15 at 17:52
  • See also: [Offline First!](http://offlinefirst.org/) – Paul Roub Jun 08 '15 at 17:53

1 Answers1

2

You can use the localStorage of the browser - it can handle all kinds of data, as long as it is not more than ±10MB. PhoneGap has some documentation about this. Because this is a HTML5 feature, you can test/debug this in your desktop browser as well (this is generally easier than debugging the PhoneGap app itself).

There are other options such as a SQLite plugin but this is probably too heavy for your intended use. An overview of more available options can be found here.

Community
  • 1
  • 1
Glorfindel
  • 21,988
  • 13
  • 81
  • 109