A crazy but elegant solution to seamlessly update a hybrid app - javascript

I am using Phonegap to develop an mobile app.
Unlike web application, an mobile app is a static client which is updated less frequently than expected. Moreover, version management is required to maintain the dependency between server and client end.
I am thinking about a way to make the mobile app more like a pure browser. And here is a potential solution.
The initial index.html in Phonegap app gets the latest version from server and compares the version number cached in the browser/WebView;
If the current version is behind the latest, it fetches the remote homepage and replaces the whole html document and caches the latest version number;
Pros:
No more need to publish new version of mobile apps;
All platforms (mobile and web) use the latest version, no more manual update is required;
Cons:
Obvious delay when updating to new version, including the first launch;
All scripts and styles must be cached in localStorage to prevent browser from reloading these files unexpectedly.
I am sure some of you must have the same problem or idea. I will really appreciate if you share your thoughts here.

If the app is a tool, such as finding nearby restaurants or calling for a delivery service, I believe some pages with fixed layout and styling will do. The functions should rarely be changed, right?
For example, you can have a page showing a Google Map with markers attached to it, indicating all the nearby restaurants. Whenever there are changes to the list of restaurants saved on the server, the client does not require any modifications, as long as the functionality of this page is kept the same as usual.
Think of the homepage of Google. There is always a toolbar at the top, a Google Doodle and a search bar underneath. The layout is almost always the same. What differs is the Doodle which is dynamically loaded. Having a fixed layout should save you from updating your app client too frequently.
By the way, I usually don't update the apps on my mobile phone, as I am too lazy to do so. Therefore, I agree with you that it is better to publish new versions as few as possible.

I created a 1-way sync that updates my local web storage (SQLite) which is on just about every device these days. My sync updates my apps login/users it gets new updates from the db an updates my apps web storage.
You can use regular SQLite to write to your devices web storage that will only update when online.

Related

Persist IndexedDB in cordova app when app updates

I have an Android app built using Cordova. Version 1, which has been released for a while, stores some data using IndexedDB. I’m ready to release the next version but updating the app wipes all the data stored in IndexedDB.
What I noticed is that on Version 1, it uses cordova-android#^7.0.0 which uses file:// as the security origin (I knew this from the debug tool). Then, on the next version, I upgrade the cordova to cordova-android#^9.0.0. Now, it is using http://localhost as the security origin.
is there a way to migrate all the existing data when the app upgraded?
The only way would have been, in the previous version, to dump JSON data into a local file as a back up, then on the next upgrade, check if the local file is present and load/inject it back to IndexedDB. But it's probably too late now...
I don't see a solution as you are set up right now...
I just upgraded from cordova-android#^8.1.0 to cordova-android#^11.0.0 and had the same issue you described.
I didn't find any solution or question besides this thread.
Just before giving up, I looked at cordova source and logic, and saw that there is a parameter called "AndroidInsecureFileModeEnabled".
I set it to true on the config.xml and it worked!
The app came back to use "file://" as the security origin, so after upgrade the app still logged in.
Later I searched about this param and found some docs about it so it's important to know the insecure impact of setting it to true. For now I don't have any choice but to use it. I hope that it doesn't affect or can break anything else...
Let me know if it helps.
https://cordova.apache.org/docs/en/dev/config_ref/
https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html

Solution for identify mobile devices by mobile browser

I'm wondering it's possible to identify android device by web app running on mobile web browser? And this solution have to still working after change or upgrade web browser on this phone.
My second doubt is web app can working offline on phone showing PDF presentations saved in local storage (disk). When I have internet connection I can manually sync presentations (some are removed and some are downloaded).
If PWA app can work like I described above or in this case we need to use (hybrid) mobile app ?
PWAs allow to cache assets and make them available to the users even when they are offline. There are some functionalities that only Native Apps have (eg. access to a device contacts), but they are very close under many other aspects.
I wrote an article about Service Workers and caching strategies where I explain how to cache static assets as well as HTTP GET calls. It is part of a series about PWAs, so you might find it useful to get more insights about this technology.
Have a look at the website what web can do today to have a list of WEB APIs currently available:
I do not know the detail of your requirements, but maybe you do not even need to implement an hybrid app and simply create a PWA.

Using HTML5 to store a database offline and update changes when the connection is restored

I'm just in the design stage of a new project. I'm wondering what technologies one would use to implement a small Progress (or MySQL) database that would allow browsers (on an iPad/iPhone/android or laptop etc) to download the database after they sign into the web page, then they could edit it while online or offline.
If they're online, changes could be updated immediately, but if they're offline they can modify the data locally and as soon as the connection is restored it can upload the data to the server.
Is there a technology available in HTML5 that would allow this to occur?
Are there limits on file size for the data that can be stored locally?
I believe the database will be small, but it may grow in some areas. Because we only need to fetch the data for that specific user, it should be quite minimal. We really want to do this as a web app to ensure cross platform compatibility, perhaps jQuery Mobile or just HTML5 and JavaScript. We would prefer not to have to develop an iOS app, Windows Form program, android app, etc.

Save site as a mobile shortcut android

I spent a lot of time to search for solution but without result.
I check this topics :
Website Bookmark/ Shortcut Icon for Android Help. Cant get passed standard ribbon icon
Whick is very nice ,but here user must click on bookmark.That`s not what i need. May be button,or automatic script that prompt user for this and created automaticaly.For example something like this :
http://socialmedia.biz/2012/02/21/encourage-visitors-to-save-your-site-as-a-mobile-shortcut/
But it`s work only on Apple devices .. What im looking for is a similar solution for android.
Is this possible at all?
May be the only solution is to create simple app that act like a shortcut to my web page?
The page that is talking about has a mobile version ..
Have you looked here [for Chrome]? https://developers.google.com/chrome/mobile/docs/installtohomescreen
May be the only solution is to create simple app that act like a shortcut to my web page? The page that is talking about has a mobile version ..
If this is "allowed" and doesn't go against too many guidelines, this might be your only option. Basically you'd want to create a one Activity application and all it does is call the default Intent for your web page. This should push the user into the default Browser.
You could put the app in the Google Play store and link to it from the site or a script. I'd call the app something like "SITE_NAME Web Shortcut" and make it clear in the description that the only purpose is to launch the browser -- as previously mentioned this doesnt "feel" like something that should be in an app store, and if users think they're getting something extra you'll definitely get bad reviews.
(I'd also make the Activity with #style/Theme.Transparent)
Please be aware that Chrome has changed the way that installs web apps.
Here are the details: https://developers.google.com/web/updates/2018/06/a2hs-updates
There is an install criteria now:
The web app is not already installed
Meets a user engagement heuristic
Be served over HTTPS
Includes a Web App Manifest that includes:
short_name or name
icons - must include a 192px and a 512px icon
start_url
display - must be one of fullscreen, standalone, or minimal-ui
prefer_related_applications must not be present, or be false
-Registers a service worker with a fetch handler

What is the proper way to force users to update Metro Applications?

What is the proper way to force users to update Metro Applications?
An example:
Let's say we have a metro style (Windows 8) application named "xyz".
We deployed "xyz" to Windows store. One week later we found a huge bug on the payment page.
So we should force the user to update the xyz application to new version.
What is the best practice for that? Does Microsoft provide a solution?
You can't force a user to update an app as such, but you do have some options...
The windows store will automatically let the user know that there is
an update available. This behaviour comes for free and you don't need to code for it.
You can make a "current version number" available via the web (maybe just as a static XML file). Then you can get your app to check this number against an internal variable. If the currently installed version is older than the updated version then you could display a "Please visit the store to upgrade" type message instead of the main app UI.
Neither of these options mean that your app is forcing an upgrade, but they are making the user aware that an update is available, and that functionality may be impacted if they don't upgrade.
You may find what you are looking for in
Windows.ApplicationModel.Store.CurrentApp
With this you can take the user to the app store page from a dialog stating that an update must be performed.

Categories

Resources