How to Connect Database in Phonegap API for Android and iOS - android

Hello I am developing application using phonegap, I want one Html page and i will put the button.
On click of that button it must fetch my sqlite3 database and just simple it must display to my next or same html page..
depending upon query.
Please anwer my question and what IDE I must use.....

To use sqlite3 on a phonegap application, you will need this Phonegap-SQLitePlugin.
However, the plugin has been designed for Phonegap 1.7 so you might need to upgrade it.

You don't need to use any plugin, as webkit already has sqlite available. I have written a data access framework to sqlite in phonegap, please check here.
It's quite easy to use, you don't need to write any sql scripts. It works very like asp.net entity framework.

Related

Migrate sqlite database from android studio app to Xamarin.Forms app

I've been developing an android app for the last year or so in android studio. It has been in the play store since October and quite a few people are using it.
I have received many requests to create the same app for iOS and so after a lot of research I've settled on xamarin forms as it will be easier to code (as I'm familiar with c# and xaml) and less work to maintain the app for both platforms at the same time (even though it will take a while to port the code over).
The android app is using sqlite for data persistency and the xamarin version will do the same.
My question is, how could I port the sqlite databases of existing users to the new app once it is released? Is there a way to define the table/column names the same as I have set them in the android studio version?
Currently the app has a feature to export the database to the Downloads folder and the xamarin.forms app will import it from there.
I haven't seen anyone in any tutorial explicitly define the table and column names in their xamarin.forms sqlite implementation so I'm a bit worried to take the leap.
Is there a way to ensure that existing databases will work out of the box once imported in the xamarin.forms app? If not, could someone please point me towards a piece of code that will migrate data from one dB to another?
Thank you in advance for your time.
Regards
As I got a bit more familiar with the SQlite package in Xamarin.Forms, turns out that the answer is as simple as adding the [Column("my_column")] attribute above the property in the model. This way it will name the column to whatever is specified in the brackets and I can make sure it matches the database schema I have in my current project from Android Studio.
a bit of a "duh!?" moment here for me but thank you to all who have taken the time to answer!

can I use the same database for android which I used for ios?

I need to know that whether we can use same database or URL for ios as well as android.
For example I am logged in with android so in the section where we use the URL , can we use the same URL for android which we use for ios. Actually I want to make an app for ios and android both.
But I want to make only one database for both that is android and ios.
I have tried using one URL in my login activity which was working on ios..but its not working.can somebody guide me?
Yes. It is very possible. It depends on the method youu are using to retrieve/send data to the database. The most popular ways to do the same is use of REST or SOAP to do client-server communication. Both work fine, but you will need to learn about doing the same. I would recomment REST for android since it is the most commonly used and is also easy to understand and use.For Ios i would recommend the AFNetworking library, speed is recommendable. You can download the library using this link:
https://github.com/AFNetworking/AFNetworking

How to use RestAPI in xamarin for Visual Studio

I want display or modify SQL data through app. I am using xamarin for Visual studio and currently creating app for android. I have created Web API(Rest) which has three methods . One method retrieves data , second method verify data and third method add data in to the database.
Basically I created this API so that I can use it across multiple platform. I need some hep for android app how to consume that rest API and call particular method based on click event of Button.
If there is any other way through which I can securely use SQL database using Xamarin for visual studio .
Any any tutorial, example or link will be highly appreciated.
Thanks,
Take a look on the Xamarin website:
http://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/
There is a tutorial here:
http://www.youtube.com/watch?v=VfoJCd_TMx0
There are some Xamarin components which may help too, e.g:
https://components.xamarin.com/view/restsharp/
Hope that helps

Phone gap sqlite plugin vs websql

I have been working on a simple database application for a small phonegap project. I have successfully implemented a websql database that stores a single table with some basic data. Recently I have been reading that this method is being phased out gradually due to some limitations. There seems to be an alternative using a webkit plugin for phonegap. This interfaces between the sqlite database on the phone and the front end.
So my question boils down to: What is the best practice when developing a database application using phonegap? Which technologies would you suggest? Any help is much appreciated. Thanks
Hi if it is larger database then go for Native sql plugin, if it is small then use HTML 5. HTML database They are fast, flexible and never expire.all of the queries are run via JavaScript, they persist until manually removed. but if the DB size is so large application must hang, so for much larger DB manipulation you can use Native Sql.and HTML 5 db Not ideal for sensitive information like password.
refer this may help you.
I suggest you to use a sqlite plugin. I have an application since android 4.0 using websql, and now, on the devices using android 4.4, my application stops working.
Don't commit the same error that I do. Use android native sqlite instead html5 websql.

Using an SQL query builder library/framework with Android

I am currently working on an Android project and will have to manage database connection and queries to store data. I will not be working with SQLite as provided by the Android device and using it is not an option.
As I need to build quite a lot of queries I wanted to use a library or framework to make the task easier. Looking at what was available, it seemed easiest to use a framework such as, for example, QueryDSL.
However, since I am working on Android, I am not sure if the framework is usable and what using it would entail. Does somebody have experience using an external database with Android and have any recommendations?
The recommended way to connect to an external database is to use a REST client.
See this post

Categories

Resources