Page 1 of 1

Storing data / files on device to access without refetching from the internet / appery

Posted: Sat Feb 20, 2016 11:05 am
by skarun

I would like to know how you can store information or files on device.
eg 1. I load a page and it retrieves the information. I then close and re-open the app. The info needs to be loaded from local if device is not connected to internet.
eg 2. I load an image and click on "i like". It shows up in my "liked list" and when I click on it I do not want to again fetch it from the internet.


Storing data / files on device to access without refetching from the internet / appery

Posted: Sat Feb 20, 2016 11:43 am
by Julian De La Rosa

you can use file system relative to your app look here http://www.raymondcamden.com/2014/11/...


Storing data / files on device to access without refetching from the internet / appery

Posted: Sat Feb 20, 2016 9:44 pm
by skarun

That's a very good example. Thanks much Julian for your help & response.

Is there a way appery gives some in-built features to do this. I would like to explore an appery.io recommended way before implementing a ionic / cordova lower level code, to be not having any compliance difficulties in future. (My ignorance may be reason for asking this question, but no harm asking :) )

[This is just due to my AngJS deficiency, I need to explore how to read and write blob - read from appery's file-collection; more for my reference, but if readers have comments or readymade code would appreciate:
some info from the raymoncamden.com link


Code: Select all

     var blob = new Blob([log], {type:'text/plain'}); 
     fileWriter.write(blob); 

]


Storing data / files on device to access without refetching from the internet / appery

Posted: Sat Feb 20, 2016 11:02 pm
by Julian De La Rosa

a blob is a large binary object. It's intended for writing large chunks instead of regular character writing based. For example if you have an image of 1MB you could write it in 4 operations of 256KB each. Instead of 8KB in each write. Since phones have solid state drives this would be faster than in headed disks. So you could write an entire 1MB in a single write operation without compromising perdormance. Inside a Blob you will have exactly the same data as if you open your file with a text editor. Note that i think blobs are contiguos spaces so they depend of the definition of the hardware/OS for allocation of the chunks... That last statement to be confirmed by someone else jejeje


Storing data / files on device to access without refetching from the internet / appery

Posted: Sat Feb 20, 2016 11:17 pm
by Julian De La Rosa