[App Updater] - Check and download updated file (JSON)


#1

Hi there!

I am working on a app to help members of my club quickly access monthly schedules.
Datas are store in a local JSON file that I read with a
$http.get('js/schedules.json').success(function(data){ $scope.data = data; });
No problem here, it work just fine.

In order to manage schedules updates I would like to setup a way in the app to check if a new version of the “schedules.json” file is available and if so, download/replace the local file.

Two questions for you guys:
1- How can I setup this updating-process?
2- Is it a better way to deal with this?

Thank you for helping!


#2

you could make a version in your json and check the version … for example

{
  "version" : "1.2",
  "schedules" : [
  ]
}

#3

Thank you @coreelements for this idea!

Now if checking is true, how to download the newest file and overwrite the local one with Angular?
A piece of code will be greatly appreciate.
Sorry, I have more a designer background… ^^

Thanks.


#4

to download/upload files to the device:

http://ngcordova.com/docs/plugins/fileTransfer/

Other file functions

http://ngcordova.com/docs/plugins/file/