Toast Plugin Sample jQM App

Sample jQuery Mobile app that uses Toast Cordova plugin.

🚧

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.

In this section, you will learn how to import and configure the Toast Cordova plugin.

Downloading the Plugin

  1. Go to the plugin page and click Download ZIP to save the file to your computer.

Uploading the Plugin to Appery.io

  1. From the platform main dashboard (not in the App Builder), go to Resources > Cordova Plugins.
  2. Click Import Cordova plugin.
  3. Click Choose file and upload the plugin file you downloaded.
  4. Click Import plugin. The plugin will appear under Cordova plugins.

Enabling the Plugin in an App

The plugin you just uploaded is available to any app. Before you can use it in an app you need to add it to a particular app.

  1. Inside an app, go to Project > App settings > Cordova plugins > Imported Cordova plugins.
  2. To enable the plugin for the current app, check the box for the plugin.

That's all the configuration you need to do for this plugin.

Now you can use its API as described in plugins documentation. For example, you can execute the following code on button click to show the toast:

window.plugins.toast.showWithOptions({
        message: 'Hi there!',
        duration: 'short',
        position: 'top'
    },
    function(a) {
        console.log('toast success: ' + a);
    },
    function(b) {
        alert('toast error: ' + b);
    });

Sample App

🚧

Important Note!

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

We’ve prepared an extended app with the Toast plugin enabled. In this app, you can modify your Toasts message, duration, and position from the page. The app looks like this:

425

Sample Toast app.

You can create this app from a backup to see how it works.

👍

Important notice

Be informed that when creating an app with Cordova plugins it is important that the needed plugin be imported before you proceed with the app UI or create it from a backup.

To create an app from a backup:

  1. Click Create new app.
  2. Type an app name.
  3. Click From backup and select the backup file.
  4. Click Create.
  5. Don't forget check Toast plugin in the App settings.
  6. As this app uses the Cordova plugin the app has to be tested on the device. Go to the Export, select device and test on the device.