CRUD operation in PhoneGap application using SQLite Database

Introduction:
Few days ago I received a comment from one of the reader of my blog to show an example on CRUD (Create, Read, Update and Delete) with the database. So in this post we will explore the use of CRUD operation using SQLite database in PhoneGap application.

Description:
CRUD can be described as a process, which helps the user to add, view, search and modify the information inside the database.

Here are the basic steps which demonstrates CRUD operation.

  • Create or add new entries
  • Read, retrieve, search or view existing entries
  • Update, modify or edit existing entries
  • Delete, deactivate or destroy existing entries

Before doing any operation on database let’s initialize the database first, either using HTML5 local database concept or using SQLite plugin.
Continue reading

Adding events to native calendar in PhoneGap iOS application

Introduction:
While developing a PhoneGap application, I got a new requirement to add an event to native calendar from the application. So that user can get aware of the details of the event from native calendar.

Description:
To implement the same, I goggled for while and found a nice and interesting plugin which is very easy to integrate and works with PhoneGap smoothly. It allows the user to add the event to calendar of that device. Here are the steps bellow which will guide to integrate the calendar plugin in PhoneGap iOS application.

1. Download the calendar plugin from github by using this URL.
https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin/tree/pre-3.0
Continue reading

Copy existing sqlite database into PhoneGap iOS application

Introduction:
Usually PhoneGap supports SQLite database to interact locally. There might be a scenario where we need to create the database freshly or sometimes need to use the existing database. The idea of writing this blog came to my mind while encountered a question in stackoverflow site.  In this blog we will focus on importing existing database into our PhoneGap application and use the same to interact with our application.

Description:
Lets have a pre-populated database having tables with data which needs to be imported to our application. It will help us to minimize our effort in creating the database freshly to the application on its startup. For this we need to follow the bellow steps.

Step 1 : Remove the .sqlite extension from the sqlite database. Ex. If we have the database called DummyDB.sqlite make it only DummyDB.
Continue reading

Integrate SQLite plugin in PhoneGap iOS application

Introduction:
For offline storage in PhoneGap application, we can use local storage or storage API. But there are some limitations of this storage mechanism. So here we will discuss on creating local database with larger storage limits with the help of SQLite plugin.

Description:
To overcome the limitations, we can use the SQLite plugin which is very easy to integrate. Here are the steps below which will guide to integrate the SQLite plugin in PhoneGap iOS application.

1. Download the SQLite plugin from github by using this url.

https://github.com/lite4cordova/Cordova-SQLitePlugin

2. The plugins are inside Cordova-SQLitePlugin / src / ios /. Let’s drag the SQLitePlugin.h and SQLitePlugin.m files into the Plugins directory in Xcode and choose the “Create folder references for any added folders” option while adding reference.
Continue reading

Urban Airship integration to receive Push Notification in iOS using PhoneGap

Introduction:
Push Notification is a mechanism, which allows an application to notify the user about any new events without opening the application, same as a SMS pops up on our mobile screen. Push Notification can work both in background and foreground, so this is a nice way to interact with the application in the background.

Description:
Urban Airship provides easy and effective solution to push the notification to user. It can act as as a middle layer which will help us to send the notification from our server routing it through the Apple Notification Server.
So in this blog we will discuss the use of Urban Airship to send push notification to our application. Here are the steps bellow, which will guide us in the process of integrating the Urban Airship plugin in iOS application using PhoneGap version 2.6.0.

Step #1:
Download the plugin for Urban Airship from github with this URL.

https://github.com/urbanairship/phonegap-ua-push/tree/1.0.8
Continue reading

Ways to include different video formats in different browsers and mobile devices

Introduction:

First of all my hearty thanks to Corinne Ducusin, one of the reader of my Tip How to play multiple videos in a loop using HTML5 and JavaScript. She is the person, who anyway encouraged me to write this post.

Yesterday I received an email from her, which includes a query, “how can we include the different formats of same video file to play it in different browsers”.

We all know that all browsers do not support same media formats of videos. So it’s a best practice to include different formats of videos to play it in different kind of browsers and devices. The browser will detect the supported format automatically and play that video file.

Description:

As per that post, videos were declared in an array to play them in a loop using HTML5.
var videoSource = new Array();
videoSource[0]=’video/video.m4v’;
videoSource[1]=’video/BigBuck.m4v’;

So now the question is, how can we include the other formats for the same video? If we declare the array like below, will it work? Continue reading

Conversion of speech to text in Android devices using PhoneGap

Introduction:
Speech to text conversion is the mechanism to translate the spoken words into text. It is also known as automatic speech recognition. Whereas Android provides the native functionality to recognize the speech and convert the same to text. We just need to invoke the native module to fulfill our task.

Description:
While working with voice to text conversion in Android using PhoneGap I came across SpeechRecognizer plugin.It is very easy to integrate in PhoneGap application and also helps us to recognize the speech and convert the same to text in json array. So bellow are the steps to integrate this plugin with Android using PhoneGap. Continue reading