PhoneGap mobile App + Database performance improvement - android

I am creating mobile application using HTML5 (AngularJS, PhoneGap). For local data storage I am using PhoneGap. My application is kind of account management software which required to store lot of relational data on local db. I deployed the application on mobile using command.
cordova run android
I am using following script to data store
http://docs.phonegap.com/en/3.0.0/cordova_storage_storage.md.html#Storage
This is working properly but performance is really bad (I having Moto G, Quad Core processor, 1 GB RAM). I fired 3 different select query on local database, and it took almost 2-3 second to process. each 3 table has only 1 rows.
I have seen performance matrices provided here. But to reduce my overall effort I am thinking of using PhoneGap.
So here are my questions
How to improve performance with phoneGap on mobile database?
I checked the db file application creating in emulator. Found that it's sqlite db file. The same database gives very good performance on native android application. How?
Since I am creating mobile application with local database. How suggestive it is to use phonegap database interface?

Use the Cordova SQLite-Plugin. It should perform much better for your purposes. Native Android also uses SQLite as database.

Related

Bidirectional Data Synchronization between android sqlite and Derby

We have build and Android app with sqlite db and a Windows program with JavaFX that can use either Derby db or sqlite db. Synchronization does not want to use a server yes old fashion wire form one device to another. So my question is has anyone found an open source API to accomplish this task? As a novice developer I might add that the perhaps the other fly in the soup is we would like to encrypt the data on both databases. This fly can be optional. The desktop development is using NetBeans and the Android development is the obvious Android Studio.
If anyone has a book or web site suggestion that would be great.
We can consider a NON FREE API with cost as a factor.

Use a common database for Sqlite

I am currently using Apache Cordova with Visual Studio 2015 for my mobile app development. I am also using Genymotion emulator and a Sqlite Database.
I noticed, if I am to use two different devices(Merchant POV & Consumer POV) to demonstrate my app, the database I will be using will be not be a synced database due to it being two different devices.
Is there any way I can make sure that both devices are using a synced database?
You would need a custom sync API to synchronize data like that. But if you are only in the early stage of testing your local database, you can make a script that loads some sample data wich will be executed on opening of your app. That way any device will run the same script and then have the same sample data.
But if you want to insert data on a device and then have that same data on another, you will have to sync it with your API.
hope it helps

Creating offline android app using Phonegap and associated memory limitations

We have a very strong base of iOS apps and salesforce running at the backend. I am trying to get the similar app running on Android but using PhoneGap (not going native).
I had few questions about this:
Does PhoneGap put any limitation on how much RAM can be used for an
app? If yes, how much?
Our iOS apps tend to consume upto 100MB of memory when multiple views and data are loaded in the app, is this feasible using PhoneGap?
CORE data gives me a nice GUI to design my local storage, how can that be achieved in Android?
Is there any way I can import the exact data model from iOS to android?
I spent quite some time searching this but did not get any satisfactory answer. All your help is much appreciated.
PhoneGap doesn't put any limits on how much memory is used. If there are any sort of memory limits it would come from the OS itself.
If you can build it as a website, you can build it with PhoneGap. The only thing to watch out for is if you don't manage your DOM structure you could actually crash the WebView, but if you manage it well you should be fine.
Unfortunately with PhoneGap, especially with offline apps, the only two options you have are localStorage and Web SQL.
AFAIK there is no way of exporting the data model to Android that would be usable with PhoneGap. The closest would be to go though and try to recreate through one of the storage options I listed in 3 that are supported and well documented with PhoneGap.

sqlite and background services in Sencha Touch 2

I am a newbie to Sencha Touch, and we need to build a cross platform mobile application which involves upsync and downsync of quite a large amount of data through REST Web Services as background servies in Sencha Touch and if internet is not available data has to be stored in local sqlite db and after connecting to internet, data has to be synced. I have googled it but didn't get enough information on this. Can someone please guide me how to achieve this?
Thanks in advance.
There is no direct way of using SQLite in Sencha Touch. However, you can indeed use Phonegap to achieve SQLite DB connection in your Sencha Touch application. This should be fairly easy to accomplish. You can also look into Localstorage or WebSQL feature in Sencha but I am not sure that suits your requirements.
Here are some helpful links:
http://hansjar.blogspot.in/2013/04/how-to-easily-add-prepopulated-sqlite.html
http://druckit.wordpress.com/2012/11/16/using-the-sencha-touch-2-1-sql-proxy/
1) I am a newbie to Sencha Touch, and we need to build a cross platform mobile application
You need to start with sencha docs and start building some simple application.
Learn Sencha Class System
In sencha framework folder there is a examples folder you can find many examples there, use that to start leaning and experiment with it.
2) which involves upsync and downsync of quite a large amount of data through REST Web Services as background servies in Sencha Touch
Then, You need to know some more specific concepts like Store and MVC Pattern
If you are not familiar with MVC then
MVC in Depth Part 1
MVC in Depth Part 2
Useful SO link
3) if internet is not available data has to be stored in local sqlite db and after connecting to internet, data has to be synced
I think there are two ways
1, If your going to use PhoneGap (i am using it), You can do it by using PhoneGap connection feature to check internet is available or not, if not then there are ways to store data in local sqlite db in sencha.
2, I think sencha touch itself has device connection check feature (i didn't use it yet) to check internet availability and if not then as i mentioned above you can use local sqlite db.
So start trying and if you got stuck post here. you will get help from me and my fellow SO users.
We are building the same kind of application. You will need to use Phone Gap to communicate with sqlite through Sencha Touch. But Sencha Touch store couldn't directly use phonegaps functions to insert/select data into/from sqlite. You will need to use sqlite storage proxy for store in Sencha Touch.
ST's built-in Ext.Connection.IsOnline() seemed a bit flaky to me (there are reports on the ST forums that it shows a connection when a phone is in airplane mode or when wifi is disabled on a pad; in my experience it seemed to be able to detect the presence or absence of an access point, but not whether the access point had Internet access), so I went with cordova (phonegap) for checking online status.
You could maybe also set a fairly aggressive timeout on your request and see if the response.status is 0 (though that doesn't necessarily mean you have no Internet connexion: http://www.w3.org/TR/XMLHttpRequest/#the-status-attribute
As for SQLite, I used shepsii's proxy (http://www.sencha.com/forum/showthread.php?195991) for some time with success on both iPad and Android. Having read that ST's Sqlite proxy is now stable in version 2.2.1, I recently switched to using that 'official' version. Whilst it works fine on an iPad, on my Android tablet the app now hangs at the loading screen. As yet I'm not sure if that's due to the proxy or to something daft that I've done, but be wary.
In my Win8 version of the app, I just used a bunch of JSON files which can be stored in the user's local or roaming storage. For my purposes it seemed to be quite easy to mimic SQL queries using that approach, so I'm thinking of adopting the same approach in ST. The only problem is that I don't know where to put the JSON files.
I have used the following plugin for Background and Timer Services.
https://github.com/Red-Folder/Cordova-Plugin-BackgroundService
and I have used phonegap api for accesing sqlite.
http://docs.phonegap.com/en/1.2.0/phonegap_storage_storage.md.html

which mobile platforms supports SQLite Database

As i am being an Android developer, and android is supporting SQLite database,
i would like to know that which are the other mobile platforms supports the SQLite Database
so that i can make SQLite database common and can place it at one place,
and thereafter i can make database transaction from different mobile platforms.
"Due to its small size, SQLite is well suited to embedded systems, and is also included in Apple's iOS (where it is used for the SMS/MMS, Calendar, Call history and Contacts storage), Symbian OS, Google's Android, RIM's BlackBerry and Palm's webOS.[20] However, it is also suitable for desktop operating systems; Apple adopted it as an option in Mac OS X's Core Data API from the original implementation in Mac OS X 10.4 onwards."
Reference: http://en.wikipedia.org/wiki/SQLite#Adoption
If I am not wrong, even meego and maemo have support for sql lite database... In-fact sql lite was created for hand held devices, it doesn't provide all the functionalities of full fledged SQL but then you need to consider its being run on a battery powered device!

Categories

Resources