NativeScript-从Nativescript应用程序启动另一个应用程序 [英] NativeScript - Launch another app from Nativescript app

查看:86
本文介绍了NativeScript-从Nativescript应用程序启动另一个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在NativeScript中,是否可以从Nativescript应用程序中启动另一个应用程序?

In NativeScript, is it possible to launch another app from within a Nativescript app?

假设我在一个应用程序中有一个按钮,当按下该按钮时,它会启动Waze导航应用程序,并将其坐标定位到某个位置.

Let's say I have a button in an app and when pressed it launches the Waze Navigation app with coordinates to a location.

使用NativeScript可以做到吗?

Is this possible with NativeScript?

谢谢.

推荐答案

Waze使用url方案"waze://",如果您的应用程序将在具有w/iOS 9及更高版本.

Waze uses the url scheme 'waze://' which you will need to first register in your Info.plist if your app will be running on devices w/ iOS 9 and later.

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>waze</string>
    </array>

然后可以从随附的utils模块中使用openUrl方法

You can then use the openUrl method from the included utils module

var utils = require('utils/utils');
utils.openUrl('waze://?ll=37.44469,-122.15971&z=10');

NativeScript openUrl为您处理canOpenURL和后续的openURL

The NativeScript openUrl handles both the canOpenURL and subsequent openURL for you

这篇关于NativeScript-从Nativescript应用程序启动另一个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆