0

I'm developing my first app with phonegap and have a basic question: My app includes mostly text and pictures. Both do not change very often, so I would like to store them on the device rather downloading them every time the user opens the app. My questions:

  • Does the app automatically detect if there is not enough space for the images on the device?
  • I want to fetch the data from a MySQL-database; is there any kind of push notification to tell the app that it should update the data? Or is it better to check for updates in a certain time interval?

Thanks

enne87
  • 2,221
  • 8
  • 32
  • 61
  • did you solve your problem #1.? Im looking for the same implementation. #2. You have to implement the push notification plugin. https://github.com/phonegap-build/PushPlugin.git Also recode for your purpose. because check for updates with a time interval is not the best way because it drains the battery very fast. Sorry for my bad english – schwertfisch May 12 '14 at 14:57
  • @Schwertfisch you can check the answer for freespace checking. – AtanuCSE Jul 08 '14 at 18:22

1 Answers1

1

You can check for free space using the following code and FILE plugin

cordova.exec(
    function(freeSpace) {
      alert('reported free space is ' + freeSpace);
    },
    function() {
      alert('failed');
    }, 
    "File", "getFreeDiskSpace", []
  );

View this answer for more details.

For your 2nd problem, so far I know you will need to write custom plugin to check for any change on server using some background service. Or you can check changes on server on app startup. I think it'll be better to implement a SYNC option inside app to synchronize your data between server and app rather than this background service.

Community
  • 1
  • 1
AtanuCSE
  • 8,832
  • 14
  • 74
  • 112