diff --git a/src/android/startApp.java b/src/android/startApp.java index ac2d5df..93a2a1a 100644 --- a/src/android/startApp.java +++ b/src/android/startApp.java @@ -44,17 +44,20 @@ public class startApp extends CordovaPlugin { if (action.equals("start")) { this.start(args, callbackContext); } - else if(action.equals("check")) { - this.check(args, callbackContext); - } - else if(action.equals("getExtras")) { - this.getExtras(callbackContext); - } - else if(action.equals("getExtra")) { - this.getExtra(args, callbackContext); - } - - return true; + else if(action.equals("go")) { + this.start(args, callbackContext); + } + else if(action.equals("check")) { + this.check(args, callbackContext); + } + else if(action.equals("getExtras")) { + this.getExtras(callbackContext); + } + else if(action.equals("getExtra")) { + this.getExtra(args, callbackContext); + } + + return true; } diff --git a/src/ios/startApp.h b/src/ios/startApp.h index a835f9a..b80637b 100644 --- a/src/ios/startApp.h +++ b/src/ios/startApp.h @@ -4,5 +4,6 @@ - (void)check:(CDVInvokedUrlCommand*)command; - (void)start:(CDVInvokedUrlCommand*)command; +- (void)go:(CDVInvokedUrlCommand*)command; @end \ No newline at end of file diff --git a/src/ios/startApp.m b/src/ios/startApp.m index b851344..a2f7345 100644 --- a/src/ios/startApp.m +++ b/src/ios/startApp.m @@ -38,4 +38,21 @@ } +- (void)go:(CDVInvokedUrlCommand*)command { + + CDVPluginResult* pluginResult = nil; + + NSString* scheme = [command.arguments objectAtIndex:0]; + + if ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:scheme]]) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:(true)]; + } + else { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsBool:(false)]; + } + + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + +} + @end \ No newline at end of file diff --git a/www/startApp.js b/www/startApp.js index 5680915..c6a6070 100644 --- a/www/startApp.js +++ b/www/startApp.js @@ -40,6 +40,12 @@ module.exports = { errorCallback = errorCallback || function() {}; exec(completeCallback, errorCallback, "startApp", "check", output); + }, + go: function(completeCallback, errorCallback) { + completeCallback = completeCallback || function() {}; + errorCallback = errorCallback || function() {}; + + exec(completeCallback, errorCallback, "startApp", "go", output); } } }, diff --git a/www/startApp.manually.js b/www/startApp.manually.js index a71f441..315b33a 100644 --- a/www/startApp.manually.js +++ b/www/startApp.manually.js @@ -41,6 +41,12 @@ module.exports = { errorCallback = errorCallback || function() {}; exec(completeCallback, errorCallback, "startApp", "check", output); + }, + go: function(completeCallback, errorCallback) { + completeCallback = completeCallback || function() {}; + errorCallback = errorCallback || function() {}; + + exec(completeCallback, errorCallback, "startApp", "go", output); } } },