Category: Phonegap

File Transfer plugin allows to upload photo or files to the remote server from the PhoneGap app.

In this tutorial, I am using Camera plugin to take a photo from camera or gallery. It will return response either in base64 format or path. You can use jQuery AJAX to upload photo in base64 format.

But it is not the better way because it works well when the image quality is low but when the image is taken from better camera device or photo quality is good then it increases the image size and takes a longer time to process, crash the app, slow down the device.

While adding File transfer plugin it will automatically download File plugin also that use to manipulate files in the device.

In the demonstration, I am creating a basic app where upload the selected photo to the server.

Capture and Upload photo to server with PhoneGap

Phonegap

Require using device camera to allow the users to change or upload their image from the app either by taking a photo with the camera or choose from the photo gallery.

With camera plugin, you can access device camera to capture a picture and select existing photos from the device gallery.

It gives a response in the base64 format or path on the successful callback that can use in image source to show the preview of selected photo or save it to the server.

In this tutorial, I show how you can implement the plugin in your project and select photo with it.

Choose an image from camera or gallery - PhoneGap

Phonegap

Data storing is a basic requirement while creating an application.

It is possible to store data online but the app needs to be online whenever data processing is required.

For local data storage use SQLite database which is already embedded on the mobile platforms – Android, IOS, Windows, Blackberry, etc.

The Cordova plugin provides support to access SQLite database in the app.

In this tutorial, I am creating an Android app where use SQLite database to save and retrieve records. Deploy the application with PhoneGap Build.

Storing Data Locally in a PhoneGap App with SQLite

DataBase Phonegap

You cannot directly access the system feature in your PhoneGap app to extend its functionality.

PhoneGap provide various plugins that allow accessing features like – camera, geolocation, contacts, battery status etc.

The plugins are written in native language for each platform e.g. Java for Android, Objective-C for IOS, etc. It is accessed by JavaScript in PhoneGap project.

You can easily add plugin using NodeJS.

Plugin implementation is different for each platform.

In this tutorial, I am adding the battery-status plugin to PhoneGap android app. That gives battery level status of the device.

To deploy the application I am using PhoneGap Build.

Add plugin to the Android app - PhoneGap

Phonegap

PhoneGap is a framework that use to build mobile applications for multiple platforms – Android, iOS, Windows Phone, Blackberry etc.

With HTML, CSS, and JavaScript you can build an application.

You don’t have to require to re-write code for other platforms.

App built with Cordova are native apps that can be published on the app store. With the plugins, you can extend your app functionality.

You can either deploy your project online or offline.

In this tutorial, I show how you can create an Android app and deploy it using PhoneGap build.

Make android app with PhoneGap Build

Phonegap