How to notify user that an HTML5 offline web app needs updating? - html

I am creating an HTML5 offline web app for use on iOS and Android.
Is there a mechanism for notifying the user that an update is available - e.g., a red dot on the application's shortcut icon? If there isn't, would I be able to achieve this maybe with push notifications or some other way?
I understand that I can use the manifest file to declare which files the app should attempt to update from the server - but my client is asking if the app would be able to visually notify to the user of the need to update.

No, None of the app's code will run unless you launch the app, at which point it will automatically update based on the manifest if you are online. If you are off line then there is no way for the app to check if it needs to be updated.

Related

How to pre-authorize URL to use microphone in Electron (or Chrome)?

I need to pre-authorize a URL to use microphone. It's an internal system accessed via Electron (v4.1.3).
Pre-authorization is required as users use it in some sort of Linux thin client. That is, each day the system bootstrap from an image and then profiles,etc are created. Therefore users would have to click Yes on the access prompt every single day, and if hitting NO just causing headaches to provide them steps to fix as the system requires mic/audio.
I've checked Google Chrome, and apparently it writes the permission on {chrome_profile_dir}\Default\Preferences file.
But on Electron, could not see same behavior on AppData\Roaming\{app.name}\Preferences file. So, to be honest I don't even know where Electron is storing the permission. I deleted the aforementioned folder, but it doesn't ask permission anymore.
Is there a way, like writing to a preference file, I could pre-authorize this? If yes, would write that to the image file.
You could use permission request handlers in electron.
https://electronjs.org/docs/api/session#sessetpermissionrequesthandlerhandler

How to allow Chrome Kiosk App configuration access for administrators?

I'm building a Chrome kiosk app that will be in a public space. Users can interact with the app, but there are a variety of settings (server addresses, timeouts, etc.) that need to be set. I'm looking for a strategy on how to allow access to that administration config.
On first run - This is straightforward, but I want administrators to be able to pull it up again.
Detect if the app ran as a kiosk app or manually - This would kind of work, not sure if it's the greatest
Detect some key combination - Ctrl + Alt + Something switches over to the settings page, this feels like people could stumble on it accidentally.
Is there another approach I'm missing?
If your Chrome device(s) is managed you have a further option which is to use the Chrome App Management area within the Google Apps admin interface.
To do this you code your app to use the storage.managed API and this should allow a Configure section for your app within Chrome App Management.
I haven't tried this myself yet but this appears to be the way the Chrome Sign Builder app is configured with its schedule.
Another approach would be to have an administrator login button in a corner of the app. You can set a default password for administrators, which could then be changed in the settings dialog.
You can also think of combining suggestions you have made, first run and then a key combination, and this could bring up a password prompt as also suggested. For an example of this see the Zebradog Kiosk app which is in GitHub so you can see code of how this could be done.
I use ctrl-alt-S at boot. This allows me to login and make changes. I know you have to do a couple of reboots, but it is out of service during admin time anyway.

Is it programmatically possible to update a windows store apps from within the app?

Is there an API that allows to me to programmatically pull the latest update from the store and refresh the current version that the user is using? If not, is it possible for the current app to programmatically know that there is a new version available?
Any samples/examples would be highly appreciated.
You can't programmatically install any Store software. But you can programmatically open the Store to let it do the user manually.
That said, there's no official Store API which you could ask about app versions (you might be able to parse the Store's HTML pages, but I recommend against this approach).
What you can do: Put a small XML file on your website which contains the latest app version number. Your app then can read this file and compare this desired version against the running app's version. If the app is outdated, the app can show a message box to the user.
I ended up using WNS and Azure Notification Hub to send a push notification to the app when it is launched. The notification is in the form of a toast message that essentially states that a new release is available. But if you updated/downloaded the app after xx/xx/xxxx, no updates are necessary.
I know it is a little cludgy but at least the users now know that the version of the app that they are using may be dated. I control the notification through Azure Mobile Service (which is free for up to 10 apps) and can fully modify the actual script.

Activate chrome app from web page?

I am building a packaged chrome app (It is needed as I want to access chrome.socket). I have a website from which I would like to call my app (if installed or ask the user to install it) by clicking a link. Is this possible ? Not able to find any easy way for this workflow.
The url_handlers might be the best way to achieve this.
You can also use the externally_connectable manifest property to declare that your website can connect to your app, then call chrome.runtime.sendMessage or chrome.runtime.connect from your webpage and handle it in an chrome.runtime.onMessage handler in the app.
Which one is better suited depends on your needs. The url_handlers is an easier way, but it will permanently assign the URL on your link to your app, so you won't be able to use it for anything else if the app is installed. The externally_connectable is a harder way, but it enables a much more elaborate bidirectional communication between your website and the app.
You can even use a combination of the two approaches, if you need: launch the app using the url_handlers feature, then establish a communication channel back to the website once the app is up and running.
Apps can now (as of Chrome 31 I believe) register to handle urls by adding url_handlers in their manifest and detecting the url causing the app to launch in the chrome.app.runtime.onLaunched event. If the app doesn't launch, your hosted web site will be loaded an can present an inline installation with chrome.webstore.install.

self cache website for offline html5

I have built a html5 gallery which does work offine but what I need help with is getting the app to detect if the user is online and if so will update the mainifest when the user opens up the app.
Firstly, you need to make sure that the manifest file isn't listed in the manifest file as this will prevent it from being re-fetched even if the user is online.
Once you have done this, if you set cache-mode to prefer-online it will re-fetch the pages when a connection is available. If you only want to update the manifiest, you don't need to do this step, most user agents will re-fetch the manifest when a connection is available as long as it is not included in its own listing.
You can also force it using the JavaScript API:
window.applicationCache.update()
You can see this example and lots more details of the JavaScript API here.