phonegap-dialogs-plugin

Phonegap Dialogs Plugin Tutorial / Apache Cordova

Want create site? Find Free WordPress Themes and plugins.
phonegap-dialogs-plugin

phonegap-dialogs-plugin

Apache Cordova / Phonegap Dialogs Plugin provides some native dialog UI elements such as alert, confirm, prompt and beep sounds. This tutorial will explain how to handle those dialogs using Phonegap / Apache Cordova.

Step 1 : Create New Project & Add required platform such as Android, iOS, Windows Phone and more

Step 2 : Add Dialog Plugin using

For Cordova 5.0+

cordova plugin add cordova-plugin-dialogs

For Older Version

cordova plugin add org.apache.cordova.dialogs

navigator.notification.alert shows custom alert to the user.

 function CallBackFunction() {
    // do something
}
navigator.notification.alert(
    'Your Message!',
    CallBackFunction,
    'Alert Title',
    'Buttin Name'
);

navigator.notification.confirm will returns a confirm box to the user.

 function onConfirm(buttonIndex) {
    alert('You selected button ' + buttonIndex);
}

navigator.notification.confirm(
    'Do You Want to Exit ?', // message
     onConfirm,            // callback to invoke with index of button pressed
    'Phonegap Pro',           // title
    ['Yes','No']     // buttonLabels
);

navigator.notification.prompt will returns prompt box to the user, you can get some text input from user

 function onPrompt(results) {
    alert("You selected button number " + results.buttonIndex + " and entered " + results.input1);
}

navigator.notification.prompt(
    'Your Name',  // message
    onPrompt,                  // callback to invoke
    'Phonegap Pro',            // title
    ['Ok','Exit'],             // buttonLabels
    'Sundaravel'                 // defaultText
);

navigator.notification.beep Plays a default beep sound on mobile device. you can set time duration for beep sound

navigator.notification.beep(2);

If you want to vibrate your mobile you can also use vibrate plugin. Read How to vibrate phone using phonegap / apache cordova

Did you find apk for android? You can find new Free Android Games and apps.
MyMail WordPress Plugin free
Save $50 USD on Ionic Firebase Chat Source CodeEXPLORE