Reputation: 29
In NativeScript, is it possible to launch another app from within a Nativescript app?
Let's say I have a button in an app and when pressed it launches the Waze
Navigation app with coordinates to a location.
Is this possible with NativeScript?
Thanks.
Upvotes: 2
Views: 2362
Reputation: 921
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>
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');
The NativeScript openUrl
handles both the canOpenURL and subsequent openURL for you
Upvotes: 6
Reputation: 1902
Should be easy, kinda works with schemes on both platforms...just convert this code to JS for iOS, find the equivalent for android.
How to launch another app from an iPhone app
The answer to "In Nativescript is it possible" is pretty much always yes since we're just marshalling calls into the OS' not needing native wrappers or anything around functionality.
Good luck!
Upvotes: 3