NativeScript-从Nativescript应用程序启动另一个应用程序 [英] NativeScript - Launch another app from Nativescript app
问题描述
在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屋!