Why to have files in local system ? (and not have them in the server)

22 views
Skip to first unread message

JC

unread,
Jul 3, 2015, 3:00:03 PM7/3/15
to phon...@googlegroups.com

Phonegap runs the HTML files in the localsystem, but if I say to phonegap to load an "http://mypage.com/page.php" instead of the default localhost index.html, it works too.

And if I run things like geolocation, accelerometer, or other plugins , they work too.

Having all pages in server allows me to change anything I want without having to upgrade an app (building, uploading to market, waiting to be published in case of iTunes, ...)

I see just advantages ...

Then ... why the local pages in Phonegap if you can run more comfortable things in server ?

I understand that local files can be useful to browse app without internet connection, but in case an app needs "always" (or almost always) internet-connection (as a feature, let's say for example like Foursquare) ... is any other advantage to have all files in local ?


Thank you

mayor

unread,
Jul 3, 2015, 3:32:32 PM7/3/15
to phon...@googlegroups.com
the short answer is that APPL will reject your app.

you need to make sure to handle situations where there is no network... even if it's just displaying a screen that says "need net".

also, for speed.  having something local is better than having to go get it.  watch out for requiring too many external resources in your app as well.  the more net connections required to load your "page" the slower it will be.

I get around all this by having my index.html file-transfer a "bundle" down from the server that includes all HTML/CSS/JS then loads it as a file url (it errors nicely if no net).  this is brute force, but it is perfect for my needs.

better to use the new content sync stuff though...

Jesse Monroy

unread,
Jul 3, 2015, 5:46:59 PM7/3/15
to phon...@googlegroups.com
Your Apps need to work offline too. Unless you plan to have no users.

Jesse

JC

unread,
Jul 4, 2015, 5:13:49 AM7/4/15
to phon...@googlegroups.com
Jesse ... take example of 

Foursquare ... it ALWAYS need network to work, to get lists, to get nearby places, to get venue information ...
Whatsapp (except the ones just "remembering conversations") needs always internet ...
Google Maps (except the ones caching the maps with the "Ok maps" trick), the same
LinkedIn ...
Twitter ...
...
..
.

JC

unread,
Jul 4, 2015, 5:14:01 AM7/4/15
to phon...@googlegroups.com
Ok, you convinced me ;-)

Kerri Shotts

unread,
Jul 4, 2015, 3:37:34 PM7/4/15
to phon...@googlegroups.com, ski...@gmail.com
1) Your files are local

The benefits from this should be pretty obvious: fast access, no waiting for (potentially lengthy) downloads, no worry about incomplete or corrupt downloads, etc.

2) You have the opportunity to handle the lack of network connectivity gracefully

This is a requirement for Apple, BTW. Your app must /at a minimum/ alert the user appropriately. Not displaying a UI or a blank screen or the like is not acceptable. 

3) Consistency

All your users on a particular version of native code also have a particular and known version of your web code. It always helps when debugging to eliminate potential issues, and this could be a biggie. What if your user has a corrupted version of your web files? What if a download was incomplete? Good luck debugging that (unless you're also checking the download integrity, and even then, hashes aren't guaranteed to be unique for any given input!)

4) Security

The download from the App store is about as secure as you can get (note: I'm not saying it's /perfectly secure/). If you download the files yourself, you have to worry about the validity and integrity of the files you download. That's not to say that it's impossible, just harder and riskier. The cost of implementation may not prove beneficial wrt the risk of losing your data. 

(Oh and don't forget that if someone were to modify your files in transit, now they have access to all the plugins your app has installed. Depending on those plugins, that could be disastrous.)

Finally: Use known and well-tested solutions to do this if you must: don't go building your own solution. Make sure that whatever solution you use can verify that the server it is connected to is the one you expect (SSL certificate pinning / fingerprinting) and that it properly handles incomplete/corrupt file transfers. You should also consider your user's network in this too: an LTE or WIFI connection isn't guaranteed to be fast!
Reply all
Reply to author
Forward
0 new messages