Offline first via browser storage or device storage? - webview

I previously worked on an app that used Couchbase-lite for mobile storage. this app was a native Android app. But I think it would be possible to replicate most of what that app did with a web-view via pouchdb or something similar.
I'm assuming that a webview would act the same as a browser in terms of cookies/data persistence/etc, or at least allow access to webpage that would cache information on the device.
Would there be any drawbacks for creating an offline-first mobile app via browser features instead of using a mobile devices storage? i.e. What would the cons be of creating a webview-based app that used PouchDB, instead of a cordova or native app that used Couchbase-lite?

Related

How much data can I store in IndexDB from a mobile phone using a PWA

I have a PWA designed in Ionic and we are using it to take pictures. However the requirements is that it needs to work offline so we are storing these pictures in IndexDB.
However I have been unable to track down how much storage we will have access to in IndexDB and am concerned it will only be around 50MB or so. The the customer potentially wants to store 100 images or more offline and when it gets back to wifi it will start sending up to a remote API.
Is there any information on storage capability for indexDB when a PWA is run on a mobile device either IOS or Android?
I have seen some posts that but mainly talk about storage of the javascript files where this is actual data captured while the app is running.
NOTE: Individual images will be no more than 2-3MB each in size.

Record audio in mobile Safari

I need to create an iOS app that just displays a website. The site allows users to record audio. The purpose is to let mobile Safari users to record audio (which is currently not supported). Are there any decent solutions for this or am I going to have to hack my way through? So far I have the following two ideas:
1) Build a native application that contains a WKWebView of the site. If the website detects mobile Safari it will launch some JavaScript that the app can respond to (or it will try to bring the user to the App Store using Universal Links). The native app will then record the audio and send it back to the website somehow (either through an external server, or perhaps through JavaScript, not sure how much data can be passed, but it could be up to 1MB).
2) Use an existing solution using perhaps Cordova/PhoneGap.
Hope to get some tips!
Build an hybrid application based on cordova/PhoneGap seems to be the best in my opinion. In addition you can build for iOS and Android (if you need later).
You can easily use this plugin to achieve your app.

Tracking Hybrid Apps with Google Analytics

I have an app with some native screens and some additional content I load via UIWebView. I am trying to track both native and web content into the same google analytics account. I'm able to create an account that tracks web and I can create a separate account that tracks the native screens. How can I combine this tracking into a single account?
Track web code using ga.js and native code using GA iOS SDK
You should have a UA account ID of the sort "UA-xxxxxxxx". If you use this
same Analytics tracking ID across your web app & native iOS app, all your data will end up in the same Google Analytics bucket. Obviously, you'll have to use the javascript library in your web app and native SDK in your iOS app.
Alternative Solution (I dont really recommend this)
You can you have your web app pipe in your GA events into your iOS app. How I did this in the past was like so.
I created a special GA codes like myapp://ga-pageview/<pagename> and myapp://ga-event/event_category/event_name.
Use the UIWebViewDelegate method webView:shouldStartLoadWithRequest:navigationType: to intercept these "special" urls and do the GA callback natively.
In the web app, whereever you need you need call a GA event, create an iframe with the myapp://ga-* url scheme above. Then remove that iframe.

What is advantage of embedding HTTP server in iOS app?

In linked in implementation, they have HTTP server implemented in iOS app. What could be the reason behind this architecture, if uiwebview already handles the HTML loading and rendering.
I don't think they have a HTTP server embedded as much as they are just making very liberal use of UIWebView and the features of HTML5.
And the benefits of doing this are that they only have to write a relatively general implementation of the LinkedIn mobile interface in HTML5 and those changes get carried across to iOS, Android, Windows Mobile, and whatever other mobile platforms support HTML5.
I have a couple of apps with an embedded HTTP server. This is used as one possible method for importing/exporting data to/from the app. The user connects to the app from their computer's web browser to the server on their iOS device. The user can then download a file from or upload a file to the app. I added this feature before iOS supported file sharing via iTunes and the Documents directory. It's now one of several ways to get data to/from the app.

iPad / iPhone Offline Webpage

I need to supply a single page website for a client to view offline on an iPad / iPhone.
The webpage will have Javascript, image and video assets. Reading about Cache Manifest it seems the cache on iPad is limited to 5mb.
Anyone suggest any routes forward, which ideally do not require the use of an additional app, but will allow for the offline storage of video.
You will likely have trouble with Safari to guarantee availability of your web page and videos offline.
The most reliable alternative would be to create an app using PhoneGap, because that would give you control over the video and the web page being stored offline. However that requires you to distribute it as an iOS-app to your client.
If you don't/can't distribute it as an app, you could try to find an app that is designed for offline browsing and supports video on the appstore. If you search for "Offline browser iPhone" on google or appstore you will be presented with some alternatives.

Resources