How to use phone plugins in our Android project

I need to use an sms plugin in my Android phone app

I downloaded the required plugin. In addition, I changed all 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 a link to any working project that uses the plugin (any) so that I can know where I get this error.

thanks!!!

+4
source share
4 answers
 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 js phone delay will be in the form above

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){}); 
+1
source

Here you have a working sms plugin for a telephone conversation. You can use it as is or rewrite it for your specific needs!

SMS plugin

0
source

Do you mean how to use the plugin in the phonegap project, or do you want to use the phonegap plugin in your Android (studio) project (if you are developing Android applications with your own version of langueage / java android studio)?

The best way out of the plugin documentation. You can also check this link: http://javatechig.com/cross-platform/phonegap/phonegap-sms-plugin-android

0
source

Source: https://habr.com/ru/post/1438376/


All Articles