Auto updating an html/angular app in client side - javascript

I'm building an app using angular. The app will run on the clients computer. When an update is there it will download a zip file from the server and upgrade the required files.
I guess js and html is incapable of copying and modifying files. Our first idea was to run a background application on the os to check for updates and do the updates as necessary. But what other approaches are there to achieve this?

Even if the application is offline, you can still host it, just use AppCache or something like it.
See this post for a tutorial:
http://www.sitepoint.com/creating-offline-html5-apps-with-appcache/

Related

Looking for a technology/code in java or other maybe to sync files from browser or https

https://github.com/deanhiller/webpieces is a platform that you can write code in java without rebooting the server via it's DevelopmentServer.
Now, to avoid the cycle of fix code, deploy to cloud, test, fix more code, deploy to cloud to test, I would like to just sync changed files to the cloud container so that the cycle becomes
change code
test
no more deploying and since you are just uploading human changes, it's FAST. Now, webpieces is a webserver that hosts a website or json api or whatever. I am thinking of 2 ways of doing this but not sure the technology is there?
Go to webpage on the cloud server and input local source directories to monitor
Locally, just run a program webpiecesSync configuring source directories and the json api to hit on the cloud instance
Number 2 has an extreme advantage over #1 in that I can register for async file notification of changes so as you change a file, the sync uploads it to the cloud and webpieces DevelopmentServer just saves the file to the needed location and when you hit the webpage with the change, the DevelopmentServer does the work of recompiling when needed.
I am not sure #1 can even come close to #2, but if anyone knows of a technology there, javascript or whatever that could maybe do this, I am wondering if I could make a wizard in the DevelopmentServer sync plugin (if I had one) that would then just keep up to date with changes of the directories and grab those files(assuming the user gives it permission somehow). I am very lost if #1 is even feasible?
Any ideas/guesses greatly appreciated.
thanks,
Dean

cordova/phonegap app - load js css and html from server

I'm developing an cordova app for Android which has a lot of logic (js) and design (html/css) same as my web application. I want to share these assets among web app and android app. Now I had compiled all these js and css in apk, but when some code is changed, I have to prepare an update and put in the play store. If it would be possible to load code and css from server after app started, it would reduce need for upgrading. Is there any way?
I'm considering loading shared resources via ajax and dynamically creating stylesheets and scripts in DOM, but maybe there is better approach, isn't it?
You could download the files from server every time, but i think that is not what you want because it would not be availibe offline at all and if the app it big and the connection bad it will take much time to download.
a better way is to download the files if they change. you can do that with FileTransfer.download() yourself or use a ready solution like the cordova-standalone-hydration
BUT your app will not be accepted by for example Apple because they deny an app with code they can not check
I found a plugin where you can update all your files in the WWW folder on startup or later.
Link: https://www.npmjs.com/package/cordova-plugin-dynamic-update

Is it possible to update HTML/CSS/JS files in a PhoneGap app with out re-deploying?

If a user has installed my PhoneGap app is there any way to update the static files such as the HTML or CSS with out the need to re-deploy the app again?
For example, when updating a web app, the developer can make a change to a CSS file on the server, and on the next page refresh the style change will be visible to the user.
I'm assuming being able to do this is unlikely due to the app needing to be packaged up and installed on the device, but I'm looking for some verification.
You could change the app to import the file externally from a server (something like <link rel="https://linktofile.com/file.css">, which means you can change the app's style at any time without re-compiling the app.
Otherwise I am not aware of any other way.
#Stavros_S
delopying a website as is suggested by Praveen Kumar is NOT best practice for mobile Apps.
Recently, Google created a new means to do what you want. It is called an Expansion File. Read this:
https://iphonedevlog.wordpress.com/2014/12/12/adding-an-android-apk-expansion-file-to-a-cordova-project/

Force live users to expire assets for JS Web Apps

Our web application is built on AngularJS and Ruby on Rails. Sometimes we find a bug in the JS and need to patch it immediately. We push up an update to Heroku and the new JS files are then live. However, users on the site (who are currently on the site) and do not refresh their page, are still using the old JS file.
Is there a way to force refresh of the assets on deployment with Heroku? Or, is there a better way to handle this type of problem?
I am thinking of using web sockets to possibly handle the scenario.

Interacting with Firebase (offline and online)

I now this is probably a dumb question, but I'm new to web development and I need to clarify this: to interact with Firebase, my code needs to be in a web server or a CDN, right? I can only test if the connection between Firebase and my files if they are online?
Thanks.
You can build and test Firebase apps without putting the files online anywhere. You can simply create a test.html on your local filesystem and open it in a browser (i.e. as a file://.../test.html url) and Firebase will work 100% fine.
Note that if you want to use Firebase Simple Login (for facebook/twitter/github/email+password auth), the files do have to be served by a web server. You can still do this locally though. You just have to spin up a local web server. This can be as easy as "python -mSimpleHTTPServer" if you're on a unix-like OS (linux, OSX, etc.). Then point your browser at http://localhost:8000/test.html or whatever.
You don't need to put the files online until you actually want to deploy your app and have other people use it.
Your server-side code will need to be on a server to execute, but that server doesn't need to be online. Try a local server like XAMPP or a bitnami stack

Categories

Resources