So I just posted this question on stack overflow because I think it relates to more than just Titanium, but it would be interesting to hear as many opinions on it as possible so I wanted to post it here as well.
Currently I'm building a few mobile apps (currently on iOS but later on Android)that retrieve information via ajax calls (returning JSON) from a Ruby on Rails application. This obviously applies to other applications as well that are using another source to return the JSON data.
The main question is WHEN to store the data and when to just use ajax calls to retrieve it. Currently, my apps do not store a single thing locally and instead require ajax calls for all data. I think for this example we can use the Twitter mobile app, which is one a lot of people are familiar with and has a lot of functionality that I'm wondering how they do it (more logically than technically).
1) When you log in the first thing you see is a list of all of the items in your stream. That list is available offline. Does that mean that when you originally signed in, Twitter already went and pulled all of your last X (100?) stream items into a local database and then future views just pull it from there?
2) If you then put your phone on airplane mode (or just shut off mobile data) and click one of those tweets, it opens up the tweet page with all of that data. So now, it looks like they aren't pulling that information in via individually each time you visit a tweet page (which is what my app currently does and takes some time to load that data in and create the views). Does it make sense that they are probably just using the same information that they pulled in when creating your stream items?
3) Users. Is it better practice to (when viewing a users "profile" page for example) store a users data locally and then refresh on future visits, or just do pull in all of the data via ajax each time? In theory each requires an ajax call...
I think those are my main questions for now. If anyone has any thoughts on any of those things (or any other insights into mobile storage) that would be great! If anyone needs screenshots of anything I referenced please let me know and I'd be happy to get those for you.
Titanium Appcelerator for iOS
Ruby on Rails for Backend and remote storage
Generally you have an issue: Ajax data-per-request vs. # of requests, so reducing on of them or both increases the Response time of your app. To achieve this you need to Cache the data. i.e. the profile:
once viewed you Cache the data, on next view you just compare
last_update or similar, yes it requires a Ajax call but now the User does not recognize any loading indicators. There is a profile and everything is fine. If the device has no Internet you can out them in a Queue.
This is a lot of more work but if you want Bug Things successful... Keep in Mund that it also reduces your Server load.
Think you can help? Login to answer this question!