where to keep the database in a phonegap application - javascript

I am new to the Phone gap domain.i have done a small application in android.i just thought of implementing it in Phone Gap and see how it works?
I have used a static database in my android project.i want to use the same for the Phone Gap project?
My big Doubt is where will we keep this Database and how will we access them?
for example..in android we create a Db methods...and store what we want in an array list? and then access them when we want?
for example
instance name = db.arraylistname(id);
column name = instance name.get(0).get("column name");
other doubt is about images.what resolution images(hdpi/mdpi/ldpi/xhdpi) should we use in the www/img/ folder?
which language is better to use in Phone Gap Jquery or java script?

I have used jQuery + jQuery mobile, and they've worked charmingly. jQuery mobile even has some documentation about using phonegap, which can be found at http://view.jquerymobile.com/1.3.0/docs/faq/how-configure-phonegap-cordova.php. I've only used ajax to access external databases, so I can't personally offer any advice on local storage, but this question on SO has a marked answer so it looks like it worked for them: Best database option for PhoneGap applications?
Let me know if you have any questions or want me to clarify anything regarding jQuery Mobile.

Related

Getting device name and model using javascript, jquery or php

I want to create a web page where I can detect the device name and model when visitor view this page from his/her device.
This is not possible in javascript. It does not have the functionality to obtain that much personal information of the user. However, it does have the functionality to tell which browser user is using. These functionalities may be available in a framework like Phonegap but not in core javascript.
Please also refer to this page:
Getting (mobile) device name from javascript
You could use the ng-fone angular module that I wrote for an app to do this.
More details here: http://tphangout.com/?p=83
You can use PHP Class which checks for user-agent to find device information.
One of most used class: http://mobiledetect.net/
This question was asked by another user: Simplest way to detect a mobile device

Cordova/Phonegap - Building DataTables with WebSQL

I'm making a small application on Android/iOS in Cordova(Phonegap). The main function of the app is to maintain some local data in a database.
For this reason I've used the WebSQL, cordova has a API to use it etc..
http://docs.phonegap.com/en/1.2.0/phonegap_storage_storage.md.html
But now i want to make a CRUD table. (Create, Read, Update, Delete)
Because i'm using Cordova i cant use PHP. The only things cordova supports are Javascript CSS and HTML. (thats why the WEBSQL). I'm not gonna use a webservice to connect with an online database (app must be used offline as well, and syncing <- its a small app, don't want to make things complicated)
So my question here is: Is there a library or framework etc.. that will make "DataTables" very fast that only works with javascript/websql? I'm not gonna program it all manually if there is a solution for this.
I have checked this:
https://editor.datatables.net/examples/styling/bootstrap.html
Its perfect in all matters ! except it uses PHP...
So is there anything out there that can help me fix this fast? Thanks in advance.
I used jQuery DataTables (http://www.datatables.net) for this purpose and I can recommend you to use it too.

Creating a note taking app using JQuery mobile and phone gap

I have an app i'm developing with JQ Mobile and PhoneGap. Within this app, i want to include a 'Notes Taking' page and it has to do the following.
Make new notes and save them locally.
Recall them whenever i need to,
Edit them and delete them
i could not find a good example to follow, i tried this:
http://tutorialzine.com/2012/09/simple-note-taking-app-ajax/
but he lost me at the index php and how to implement that, i also tried this example:
http://miamicoder.com/2011/building-a-jquery-mobile-application-part-1/
but its so complex i got lost in all the code.
I'm a beginner at programming and my JavaScript is very very poor and i have no idea where to start and what kind of code is involved in making this part of the app.
Please help. Thank you.
Your first site (http://tutorialzine.com/2012/09/simple-note-taking-app-ajax/) will not work for you as the examples are embedding PHP into the html and that is not acceptable with phonegap apps.
Your second site is making it way more complicated than it needs to be for your limited scope.
Not going to do this for you but I will give you some advice and places to look.
Draw out what you want the user interface to look like and create that html
Create a load and save function in javascript to... well... load and save your notes. Take a look at the below references:
This will show you how to interact with the local database and store and retrieve info. Always a good thing to read the documentation.
This is a great resource for help all sorts of stuff. In this case, with SQL queries.
Test, test, test. With the above, you will be able to figure it out if you put your mind to it. Come back here and post specific questions with code samples of what you have tried if you get stuck.

Application Craft, PhoneGap and Parse - A match made in heaven?

If I wanted to design apps that required data storage and were targeted for multiple mobile platform's, would using Application Craft to create the UI, Parse to store the data and PhoneGap to wrap it all up for the relevant target device be a potential way of approaching this?
Sorry for the generic question, black and white answers are ok in return.
What would be the biggest limitation to this approach?
To keep it simple, lets say the app is to capture images and text input from multiple users, store it and then display it in some form of activity feed.
I'm not very familiar with Application Craft, but it seems to be a paid version of PhoneGap -- meaning that they each seem to accomplish the same thing so use one or the other (unless I'm missing something...). PhoneGap can use jQueryMobile (or other frameworks) to help with the UI.
If you're going to use Parse within PhoneGap then you will need to find a PhoneGap plugin that allows Parse to work cross-platform. There likely are some, but if not you'll have to develop a separate plugin for each platform.

Dilemma... Which Program & Language to develop my Android and iOS App

I'm developing an app for both the android and ios platform. I'd like to take a route that allows me to only have to code once for both platforms. There are 2 options I've come across:
Develop in Flash builder 4.5 with flex (actionscript, or I've heard javascript also?)
Develop using Phonegap (javascript)
The app is very simple - it will use the google api and the phone's geolocation function, then also display more information about the business listings from google map's api. Downloaders of the app will also have to register to become free members. All of this information will have to be put into a mysql database on my server.
So my question is, which is the best route to take with what I am hoping to accomplish? If using Flash builder, is it best to learn actionscript or javascript? What's the best way to connect with the mysql server if I'm writing in javascript, ajax?
If you are serious about it and want to create other apps as well in the future, you should learn the native frameworks/languages for each of the platforms. If not, and you just want to make one quick app I would choose Phonegap rather than Flex/Flash.
Firstly, get familiar with HTML and Javascript to understand what they are even capable of. There's no point in trying to complete a project with tools that you don't understand. As for the options you named, I'd definitely go with the Phonegap method as it is much simpler.
However, you also need a backend for your solution if you're trying to use a MySQL or other database to store any data. For this you'd need some server-side language like PHP, JSP (or you could use NodeJS, if you want Javscript on the server too) etc, that retrieves information from the database according to the requests received from your app.
In conclusion, I'd suggest you to read more about PHP/MySQL, Javascript and making webpages, since this is what you are actually trying to do if you use Phonegap, even though you might look it as an app. Do some tutorials, get to know the languages before you try to take on something that surpasses your skill level just yet.
For a nice small db-interface I'd rather suggest using ruby (with sinatra as mvc-framework and activerecord on top of mysql, or just use rails) than using php!
http://guides.rubyonrails.org
http://www.sinatrarb.com/

Categories

Resources