Closed darkoromanov closed 10 years ago
Loving the idea, I've been after exactly this for, well the entire time I have been developing.
I've got the exact same problem:
I've included this in my config.xml as above, but window.plugins is not in the dom.
@darkoromanov just fyi you don't need to build first :) Run builds for you.
@jamiehutber oh, ok thanks, it's just the "paranoia mode" when things don't work. I tried to install other plugins but with no luck, please let me know if you find out how to use plugins in PhoneGap! I'm going completely crazy....
If you use local bulid, you should add plugin with 'phonegap local plugin add [url]'. Then in some cases you also need to remove platform (e.x. cordova platform remove ios) and bulid again. Addig to Config.xml is enough for remote bulid only.
@Paldom I tried also with local but with the same result:
D/CordovaLog(27638): file:///android_asset/www/js/vendor/angular.js: Line 9509 : TypeError: Cannot read property 'spinnerDialog' of undefined
it's so frustrating, it's not only with your plugin, but with all, do you know if there's some complete phonegap project using plugins to download ?
Question: I looked at the documentation of this plugin https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin/blob/d3345019f469cee0aedf7f6dd89fb8693017146b/README.md and it says to add reference to the plugin javascript:
<!-- below <script src="phonegap.js"></script> -->
<script src="js/plugins/Flashlight.js"></script>
so, is it necessary also for SpinnerDialog?
Ok I found a solution, instead of calling window.plugins.spinnerDialog.show()
I directly call:
cordova.exec(null, null, 'SpinnerDialog', 'show', ['Ehi', 'You']);
I don't understand where is exactly the problem, because if I look in platforms\android\assets\www\cordova_plugins.js I see the plugin is there:
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/hu.dpal.phonegap.plugins.SpinnerDialog/www/spinner.js",
"id": "hu.dpal.phonegap.plugins.SpinnerDialog.SpinnerDialog",
"merges": [
"window.plugins.spinnerDialog"
]
}
];
module.exports.metadata =
// TOP OF METADATA
{
"hu.dpal.phonegap.plugins.SpinnerDialog": "0.1.5"
}
// BOTTOM OF METADATA
});
but it's not attached to the window object.
Ok, I finally solved. The problem is caused an old bug in PhoneGap https://github.com/phonegap/phonegap-cli/issues/134
so i just renamed
<script type="text/javascript" src="phonegap.js"></script>
to
<script type="text/javascript" src="cordova.js"></script>
Nice one, i'm still having troubles however. renamed the js file to cordova as well ;)
<gap:plugin name="hu.dpal.phonegap.plugins.spinnerdialog" />
is in my config.xml for the live build and then:
<feature name="SpinnerDialog"><param name="android-package" value="hu.dpal.phonegap.plugins.SpinnerDialog" /></feature>
For the local, i've checked out the repo and added to plugins in the folder hu.dpal.phonegap.plugins.spinnerdialog
Ok thanks for the brilliance :dancer: phonegap local plugin add https://github.com/Paldom/SpinnerDialog.git worked like a charm.
Hi, I'm using phonegap 3.4 CLI I've followed instructions to install the plugin but I always get the js error when I call:
window.plugins.spinnerDialog.hide();
TypeError: Cannot read property 'spinnerDialog' of undefined
The steps I followed are:
phonegap plugin add https://github.com/Paldom/SpinnerDialog.git
Added row: to my config.xml in the root (widget) node
phonegap build android phonegap run android
but it doesn't work. Ideas?