Using in a jQuery Mobile App

Using Apache Cordova in a jQuery Mobile app.


Important Note!

The option of creating new apps with the jQuery Mobile framework was removed but we still support the projects that were created with it earlier.

There are a number of ways to use a Cordova API in a jQuery Mobile app:

  1. Using a pre-built service.
  2. Using Cordova JavaScript API.
  3. Using a Generic service (combining options 1 and 2).

Using a Pre-built Service

A pre-built service is Cordova API wrapped as an service. This is nice because you get to use the powerful mapping features this way. exposes the following Cordova API as a service inside the App Builder.

Click on a link in the list to jump to an example using this service.


Using Cordova JavaScript API

You can still use directly the Cordova JavaScript for these or any other plugins.


Picture Upload Sample jQM App

You can also check our Picture Upload Sample jQM App, where we show how to upload an image file or a picture taken with the mobile device camera service to the Database.
The app is able to work in two modes:

  • Uploading files via Web API (using browser API).
  • Uploading files via Cordova FileTransfer plug-in.



There can be some factors that need to be taken into consideration when several plug-ins are combined in one app.

For example, if you are creating an application using the AdMob plug-in in combination with the Push Notification service, please add the OneSignal Cordova plug-in to it. You can learn here how to do it.

Also, you will need to call the following code to open the ad:

   isTesting: true, // change to false in production app
   autoShow: true,
   id: 'ca-app-pub-3940256099942544/6300978111', // replace with your *Ad Unit ID* in production app


Note as well that the code provided above shows test ads only. To display user's production ads please replace the code with the following:


   id: '<Put your admob app id here>',

   isTesting: false,

   autoShow: true



Using Cordova JavaScript API

Any installed Cordova plug-in can also be used via its JavaScript API. For example, using the Notification API:


You can use the Cordova API anywhere you can write custom JavaScript code.

Check out InAppBrowser to see another example.


Cordova JavaScript API

To learn about available APIs, please go to the plug-in docs page on the Apache Cordova page.

Using a Generic Service

Another option is to use the Generic service. This approach is more advanced and combines using the JavaScript API and an service. When you put such a service together you get the Cordova plug-in plus you can use the service in mapping.

Check out the Accelerometer example to learn how to create such a service.

What’s Next