Ionic app for iOS, Android and Desktop Web app

Hi,

We have a requirement to develop a hybrid app for iOS and Android platform and also there is a need to support desktop( Web app). Is it possible to use the same codebase to host the app as a web app which will run on browsers like Chrome, Safari?

Regards,
Gauri

yep this will work in general.

But you should think about cases where you are using native plugins/ device apis and how you solve this cases in the browser

I posed a similar question here

Ok. Thank you. We need to provide offline capability on Mobile app. We might go for SQLite which I believe will not work for Web app. What other options are available to provide offline feature on desktop?

Thanks Richard. Yes. I saw your question too and am looking for similar information. I will keep checking your post for updates.

1 Like

depends on what data you want to store.

for small ones --> localstorage

If you need to store complex data google for indexedDb and Websql.

for simplicity or a unified api i used
https://github.com/localForage/localForage in an ionic 1 project.
It checks for browser support and uses the available.

There is also an extension, that it uses sqlite if cordova sqlite available

Is there a reason you avoid ionic-storage?

1 Like

Ok. Thank you for the information.

nothing, but i only recommend stuff i used on my own. I heard of ionic storage, but i think the api is a little bit limited. But you are write, this is another possible approach :).

In some cases https://github.com/techfort/LokiJS will help you, too. If you only need to save a few non critical data you can go with lokijs as an fast javascript in memory db. There is also a File-Adapter for cordova file, where you can sync the in-memory with the filesystem.

My understanding is that it is pretty much exactly what you have described here:

i used GitHub - localForage/localForage: 💾 Offline storage, improved. Wraps IndexedDB, WebSQL, or localStorage using a simple but powerful API. in an ionic 1 project.
It checks for browser support and uses the available.
There is also an extension, that it uses sqlite if cordova sqlite available

If u’re looking for maintaining a same code base for all platforms, Webview of Android and IOS is the API you need to know. However, you definitely will find out the differences of cross-browsers’ behavior, and would also start to think having the features from the mobile devices that can offer.
Then, you’re very possible to involve coding for Android (java) )and IOS (swift/objective C), or will go looking what is Phonegap and Cordova.
Anyway, Webview serves your primary objective.

Using WebSQL is not recommended, because it’s deprecated.

Have a look at https://www.html5rocks.com/en/tutorials/offline/storage/

AFAIK there is a WebSQL Cordova Plugin which behaves exactly like WebSQL, but uses SQLite under the hood. Sounds good, but I haven’t tried it yet. OK, there’s still the problem with Desktop Web…