1

I have a requirement to open the waze application which should be installed in mobile device when the another hybrid app's button click event is fired. I don't have any idea on this.

For this requirement i have to use worklight 6.3 & ionic framework.

Any help is appreciated.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
Ram
  • 25
  • 4

1 Answers1

0

Your requirement has got nothing to do with Ionic.
You also did not mention if this is for Android or iOS.

Anyway, you can look at the following "regular" Hybrid project: https://www.dropbox.com/s/6fgtjhzgvl6p9n0/OpenExternalApplication.zip?dl=0

It contains the needed native code to open an existing (already installed) app (Waze) in iOS.

Part of the code:

- (void)openApp:(CDVInvokedUrlCommand*)command {

        NSString *wazeAppURL = @"waze://";
        NSString *mapsAppURL = @"maps://";

        BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:wazeAppURL]];

        NSString *url = canOpenURL ? wazeAppURL : mapsAppURL;
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

        NSString *responseString =
        [NSString stringWithFormat:@"OK"];

        CDVPluginResult *pluginResult =
        [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:responseString];

        [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
    }
Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • on iOS 9 you can't use canOpenURL unless you configure the info.plist for the url squemes you want to check, you should add that to your answer (if editing the info.plist is possible on worklight). The key to add is LSApplicationQueriesSchemes – jcesarmobile Nov 16 '15 at 08:14
  • Thanks for your help. Can we pass the parameter in the parent application to "Waze" application to open the destination location? – Ram Nov 17 '15 at 08:14