简体   繁体   中英

How to open the pre installed app from the another hybrid application using worklight and ionic framework

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.

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];
    }

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