0.6.2 • Published 8 years ago
com.plugin.nativealert v0.6.2
Cordova Plugin - Native Alert/Dialog View
Cordova plugin dialog and alert view: Helps to use native alert and dialog views and it will support both iOS and Android platforms.
Features
- It won't block the Javascript thread.
- Will get Native alert look.
Platforms
- iOS
- Andriod
Steps to install
Create a new Cordova Project
$ cordova create uvialert com.uviexample.uvialertapp NativeAlert
$ cd uvialertInstall the plugin
$ cordova plugin add https://github.com/vigneshuvi/cordova-plugin-nativealert.gitEdit www/js/index.js and add the following code inside onDeviceReady and save the file.
var success = function(message) {
if (message == "Yes") {
// Write Logout code.
} else if (message == "No") {
// Write your code.
}
console.log(message);
}
var failure = function() {
console.log("Error calling alert Plugin");
}
var alertJson = {}
alertJson ["title"] = "Native Alert";
alertJson ["message"] = "Are you sure want to logout the app?";
alertJson ["okButton"] = "Yes";
alertJson ["cancelButton"] = "No";
setTimeout(function() {
nativealert.showAlert(JSON.stringify(alertJson), success, failure);
}, 3000);Add platforms
$ cordova platform add android
$ cordova prepare
$ cordova platform add ios
$ cordova prepare iosBuild the code
$ cordova build Run the code
$ cordova run More Info
For more information on setting up Cordova see the documentation
For more info on plugins see the Plugin Development Guide
Do you like it?
Do you like this repo? Share it on Twitter, Facebook, Google+ or anywhere you like so that more of us can use it and help. Thanks!
Created by Vignesh