本文介绍了如何从另一个混合应用程序使用worklight和离子框架打开预安装的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,打开应该安装在移动设备中的另一个混合应用程序的按钮点击事件触发时的Waze应用程序。我对此没有任何想法。

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.

对于这个要求,我必须使用worklight 6.3&离子骨架。

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

任何帮助。

推荐答案

无论如何,你可以看看下面的正规的混合项目:

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

它包含打开现有(已安装)应用程序所需的本机代码 Waze)。

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

部分代码:

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

这篇关于如何从另一个混合应用程序使用worklight和离子框架打开预安装的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 01:10