Reputation: 3587
I need to use sms plugin in my android application on phonegap
I've downloaded the required plugin also, I've changed all the instances of "phonegap" to "cordova" but I still get the error
E/Web Console(2086): TypeError: Result of expression
'window.plugins' [undefined] is not an object. at file:///android_asset/www/pluginexample.html:38
please give me link to any working project that uses plugin(any) so that I can know where I am getting this error
thanks!!!
Upvotes: 4
Views: 3625
Reputation: 153
Do you mean how to use the plugin in your phonegap project or do you want to use phonegap plugin in your android (studio) project (If you are developing android apps with native langueage/java use android studio)?
The best way is from the plugin documentation. You can also check out this link : http://javatechig.com/cross-platform/phonegap/phonegap-sms-plugin-android
Upvotes: 0
Reputation: 4411
var MyPlugin = function () {};
MyPlugin.prototype.mFunctionName = function (action , successCallback, failureCallback, arrVal) {
return PhoneGap.exec(successCallback, failureCallback, "ClassName", 'maction',arrVal );
};
PhoneGap.addConstructor(function() {
PhoneGap.addPlugin("mObject", new MyPlugin());
});
your phonegap js will be in above form
you can call the above js like
window.plugins.mObject.mFunctionName('maction',function(success){},function(error){});
or
var mObj = new MyPlugin();
mObj.mFunctionName('maction',function(success){},function(error){});
Upvotes: 1
Reputation: 3919
Please checkout this Add the PhoneGap Barcode Scanner Plugin to a Project, Write an App using Barcode Scanner Technology
Upvotes: 0
Reputation: 7788
Here you have a working sms plugin for phonegap. You can either use it as it is or rewrite for your specific needs!
Upvotes: 0