简体   繁体   中英

PhoneGap.exec to Cordova.exec

I'm using a plugin in my Cordova project and it's installed properly, but doesn't work. Upon looking into the JS file I found these two lines

PhoneGap.exec("SMSComposer.showSMSComposer",args);
PhoneGap.addConstructor(function() {

Obviously the problem is that the PhoneGap.exec function no longer exists, it's Cordova.exec now. How can I get this working? The plugin isn't that old, just a few months so it should work.

can u give the cordova version you are using ?, if you are using new phonegap version , use plugin for that version. If it is your custom plugin please follow this Plugin dev guide . Or check this Upgrading Guides .

  • cordova.exec(function(winParam) {}, function(error) {}, "service", "action", ["firstArgument", "secondArgument", 42, false]); The parameters explained in more detail:

function(winParam) {} - Success function callback. Assuming your exec call completes successfully, this function will be invoked (optionally with any parameters you pass back to it) function(error) {} - Error function callback. If the operation does not complete successfully, this function will be invoked (optionally with an error parameter) "service" - The service name to call into on the native side. This will be mapped to a native class. More on this in the native guides below "action" - The action name to call into. This is picked up by the native class receiving the exec call, and, depending on the platform, essentially maps to a class's method. For more detail please check out the native guides located at the end of this article. [/* arguments */] - Arguments to get passed into the native environment

links to latest SMS composer Plugin : IOS Link , Android : link

i think it may help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM