How to display a dialog with Apache Cordova
Motivation
I wanted to display a dialog in my application *1 to show text of OSS (Open Source Software) licenses. So I read the official site *2 and tried to show a dialog but I got stuck again.
Where do I need to execute commands?
The official site says that
% cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
But I did not know where the command should be executed. After some tests, I found that the command should be executed in the top level folder of the Apache Cordova project. I checked the plugin folder to make sure that the feature has been installed in this project.
% ls plugins android.json org.apache.cordova.core.dialogs/
Moreover I also checked the android platform folder like below.
% cd platforms/android/assets/www % cat cordova_plugins.xml cordova.define('cordova/plugin_list', function(require, exports, module) { module.exports = [ { "file": "plugins/org.apache.cordova.core.dialogs/www/notification.js", "id": "org.apache.cordova.core.dialogs.notification", "merges": [ "navigator.notification" ] }, { "file": "plugins/org.apache.cordova.core.dialogs/www/android/notification.js", "id": "org.apache.cordova.core.dialogs.notification_android", "merges": [ "navigator.notification" ] } ] }); % cd ../.. % cat src/org/apache/cordova/dialogs/Notification.java ...
OK! I was ready to build this project and did it successfully. Of cource I could show the dialog.
Additional
I also checked files under plugins folder and I found that the source files of the plugin have been installed there.
% ls plugins/org.apache.cordova.core.dialogs/src android/ blackberry10/ ios/ windows8/ wp/ % ls plugins/org.apache.cordova.core.dialogs/src/* plugins/org.apache.cordova.core.dialogs/src/android: Notification.java plugins/org.apache.cordova.core.dialogs/src/blackberry10: index.js plugins/org.apache.cordova.core.dialogs/src/ios: CDVNotification.bundle/ CDVNotification.h CDVNotification.m plugins/org.apache.cordova.core.dialogs/src/windows8: NotificationProxy.js plugins/org.apache.cordova.core.dialogs/src/wp: Notification.cs NotificationBox.xaml.cs NotificationBox.xaml notification-beep.wav
And I understood that the file under android platform folders was installed to the platform which I want to build. It is very nice system!