Persistence solution for mobile Phonegap / HTML5 App - database

I am developing a mobile app for Android and iOS using jQuery Mobile.
The app will be deployed to Android and iOS devices utilizing Phonegap.
My problem is that I need a local offline data storage mostly for read operations.
I am planning to pull a data set from a web server (MySQL/web service) about once a month (whenever there is new data) and store it for local use on the device.
Now the question, what persistence solution should I use?
There is a tool called lawnchair by a member of the Phonegap team. Anyone tried it? What are the pros and cons? http://westcoastlogic.com/lawnchair/
What about sqlite? Is it working across Android and iOS devices?
THX

You could simply use HTML5 Storage / SQL Lite for this. Take a look at: http://diveintohtml5.ep.io/storage.html
I`ve been using Localstorage on iOs and Android without any problems, and since localstorage is backed up by sqllite i think you should be fine. (but i can´t say anything for sure for sqllite on android)

HTML5 storage works fine on Android. A nice tool to make reading and writing to the database easier is persistenceJS.
I've just started on setting up the iPhone version of my jQueryMobile / Phonegap app. It stalls right at the point where the first call to localdb is made. This may be a problem of the iOS simulator, since the regular Safari runs my app just fine from the browser.

The HTML5 LocalStorage option will works fine until iOS 5.0. But there might be some problems from iOS 5.1 and later.
So my suggestion is to write some javascript code to back up to the document folder via fileAPI, and reconstruct the WebSQL database periodically.

Related

How to use chromium engine inside google chrome to render my application

I wonder if it is possible to use chromium engine inside google chrome or the google chrome itself to render a web page inside my WPF application instead of using traditional WebView (because it's the IE engine and it's awful -_-) or implementing CEFSharp (because it uses about 200 MB of space only for the chromium engine)
so in this case I need the target pc to has installed google chrome or any other(firefox or ...)
Soooo ... is there any solution?
thanks in advance
EDIT
I want to create applications based on web UI, - because of being easy and powerful - I know some providing this feature, e.g. CEF Sharp WPF or electron js but they include a full chromium engine with the app. I don't want this.
I want to create my app as light as possible, and my idea is to use chromium engine of a modern browser, that almost everyone has one.
For example, imagine that the user has installed google chrome.
first I locate the installation folder
I use chromium.exe -render path/to/file.html(imaginary) command to render my application UI.
finally bind the UI events to my native code. (e.g. c#(wpf) or any language that you can create desktop apps with it)
One solution is creating web apps by installing a website with the browser. but with that you cannot for example create or read some files in user pc, or any similar operation.
I'm looking for the most light-weight solution...
There is a new Chromium based WebView2 control that you can use to embed modern web content in your WPF application.
Please refer to the docs for more information about the prerequisites and how to use it:
Getting started with WebView2 in WPF
Explanation
So, let's say that you want your UI to be rendered in a chromium environment(aka a browser)… right?
let's take a look at electron js:
it uses NodeJS as backend.
it uses an embedded browser for frontend.
the language used is JavaScript due to NodeJS.
So, you want to use the client's browser to render your frontend instead of embedding a browser inside it.
well, don't embed it!!
you can create a web application(e.g. opened by typing localhost:<port> in browser1) using NodeJS and handle your IPC(between frontend and backend) using ajax calls or a socket connection.
that way you are doing exactly what an electron app does, except that, electron uses a bundled browser.
now you made your app lighter, also if your client do have NodeJS installed, you don't need to bundle NodeJS!
--- inspired by jupyter notebooks ---
Possible Solutions
use NodeJS as backend.
use python and combine it with Flask or Django as backend. (I think this would be the most lightweight solution)
use PHP as backend. (the best, personal opinion)
use ASP.NET/Blazor as backend. (as mentioned in the comments; but doesn't seem to be a lightweight solution)
or use any language that you can create a web application with that!
make a runApp.bat or runApp.sh to simply run your server and open the browser automatically.

Cross platform SDK

I am new to React Native. So here goes my scenario:
We need to create a new SDK that would be embedded into multiple technologies: React Web (JS), React Native APPs, iOS Apps (Swift and Obj-c), and Android Apps (Kotlin and Java). This SDK will offer:
APIs to get access tokens (issued by our corporate authenticator) so that the APP can talk to our API Gateway; something on the lines of getCurrentAccessToken();
Standard screens for login, Change Password, Forgot Password, OTP, etc; The UI should look and feel NATIVE to each target platform that it will be running on (Web, iOS, Android). Transitioning from a Native Screen to SDK's Screen should be smooth.
Be small (package size) and have OK/Hermes performance on both API Calls and Screen loading times (it doesn't need to be as fast as Native, as this SDK will be used once or twice every time the user starts the main APP);
I have checked boden.io (C++) but it would not work on WEB. It might still be an option (having 2 SDKs, one for WEB one for Mobile) so I didn't rule it out yet.
Is such a thing feasible in React Native? If feasible, is it a good idea?
PS: I know I would still need native binds/wrappers for each technology so that the SDK looks NATIVE to the caller, but that would be a minor issue.
Thanks
You can use go lang and gomobile to build the sdk for iOS, Android and Web.

Database in ionic ios app?

I have to develop a simple app with ionic for ios and I am not really sure how to implement the model of my app.
I need to read some data and the user have to be able to save some data alse.
The app might be able to work offline also.
Any idea? I think firebase only supports offline in ios and android but not with web.
Thank you!
what you need is persistent data storages.
localforage is one of many
https://github.com/localForage/localForage

Local AngularJS application hosted in WKWebView

I have a hybrid application built using a WKWebView. I have gotten around the loading local files issue, but I am having trouble loading an AngularJS application from local files. I am getting the following error:
Cross origin requests are only supported fro HTTP.
With Android I was able to update setting on the WebView control to allow this from file:// schemes. Is there anything similar that I am missing in iOS? Or another solution?
I am using XCode 6.3 (6D570)
This is a known issue with WKWebView in iOS 8, and I suspect that's why UIWebView remains undeprecated.
I haven't had time to use the betas yet, but my only suggestion is to give the latest Xcode 7/iOS 9 a shot, and use the new WKWebView API
- (WKNavigation * _Nullable)loadFileURL:(NSURL * _Nonnull)URL allowingReadAccessToURL:(NSURL * _Nonnull)readAccessURL
which would ideally let you pull in other HTML files as templates in the readAccessURL that you provide.
Please file any bugs you see in the latest beta. Apple is way too slow to move on the issues in WKWebView.
If you just need the Angular app to work now, then you'll need to switch to UIWebView, which is confirmed to work with angular-based webapps stored on the device.

Testing framework for ionic angular cordova app real devices with continuous integration?

Our team is starting a project and we would like to have an automated testing server that tests our app on real devices, instead of emulators or just browser.
Its an Ionic framework app, so Cordova+AngularJS.
I am going to research this and give the best answer I have, but in the meantime if anyone is familiar with it, I'd love to hear all about it!
I'm interested on that point too.
For instance, I manage to code very few tests with APPIUM but seems to do the job for tests using Selenium webserver
Looking forward for other user feedback
The intel xkd provides on device testing via the intel xkd preview app and on device debugging via the adb with debugger. Also comes with build services for android, ios, windows, tizen, amazon, nook, webapp, chrome, facebook, and firefox. This is the easiest way I have found for testing on device to make sure Cordova plug ins work and to get live JavaScript debugging. https://software.intel.com/en-us/intel-xdk
Another option is to run the ionic app in phantomjs and run integration tests using your server-side framework. This allows you to quite easily test across the entire stack. Theres a blog post about how to do it with rails at http://www.dovetaildigital.io/blog/2015/10/28/rails-and-ionic-make-love-part-three

Resources