@wuilmerj24/launch-navigator
v1.0.6
Published
It is a NativeScript plugin that allows you to easily verify if the most popular navigation apps (Google Maps, Waze, Baidu Map, and Apple Maps on iOS) are installed and open preconfigured routes with origin, destination, and transport mode directly in the
Maintainers
Readme
@wuilmerj24/launch-navigator
npm install @wuilmerj24/launch-navigatorUsage
API
Methods
| Method | Description | | ------ | ----------- | | checkInstalledApp(packageName: string or SupportedApps) | Checks if the app is installed on Android (com.id.pack) or iOS (urlscheme://). You can also use SupportedApps, which returns a boolean. | | openGoogleMaps(OpcionesGoogleMaps) | Opens the Google Maps app. Returns a Promise. | | openWaze(OpcionesWaze) | Opens the Waze app. Returns a Promise. | | openBaidumap(OpcionesBaidumap) | Opens the BaiduMap app. Returns a Promise. | | openAppleMaps(OpcionesAppleMaps) | Opens the Apple Maps app. Returns a Promise. |
| SupportedApps | | | -------------- | - | | Google Map | Android e iOS | | Waze | Android e iOS | | Apple Maps | iOS |
Response
| Property | Description | | --------- | ----------- | | error | Boolean. Indicates whether an error occurred or not. | | errorText | String error message. |
TransporteGoogleMaps
| Property | Description | | --------- | ----------- | | DRIVING | | | WALKING | | | BICYCLING | | | TRANSIT | |
Options
OpcionesGoogleMaps
| Property | Type | Description | | --------- | ---- | ----------- | | daddr | string or Array | Destination address | | saddr? | string or Array | Starting address | | modoTransporte | TransporteGoogleMaps | Transportation type | | tipoMapa | TURN_BY_TURN or MAPS | If it's TURN_BY_TURN on Android, it will start navigation automatically | | avoid? | string | Sets characteristics the route should try to avoid. Values "t", "h", or "f" |
OpcionesWaze
| Property | Type | Description | | --------- | ---- | ----------- | | destino | string or Array | Destination address | | navigate | string | Values yes or `no, starts or doesn't start navigation in the Waze app |
OpcionesAppleMaps
| Property | Type | DescrDescriptionipción | | --------- | ---- | ----------- | | tipo | string | Values s, k, h, or r. Map type transit, standard, etc. | | daddr | string or Array | Destination address | | saddr | string or Array | Starting address | | dirflg | string | Values d, w, or r. Transportation mode |
Ejemplos
Verificar si la app esta instalada
checkAppInstalada(AppsSoportadas.WAZE o AppsSoportadas.APPLE_MAPS o AppsSoportadas.BAIDUMAP o AppsSoportadas.GOOGLE_MAPS): booleanGoogle Maps
openGoogleMaps({
daddr:"Maracay aragua venezuela",
modoTransporte:TransporteGoogleMaps.DRIVING,
tipoMapa:"TURN_BY_TURN",
saddr:"Villa de cura aragua venezuela",
avoid:"fth"
}).then((res)=>{
//Ok
}).catch((err)=>{
//Error
}) Waze
openWaze({
destino:"tia el recreo quito pichincha ecuador",
navigate:"yes"
}).then((res) => {
console.log(res);
}).catch((err) => {
console.log(err);
})Apple Maps solo para iOS
openAppleMaps({
daddr:"Tia el recreo quito ecuador",
dirflg:"d",
tipo:"s",
saddr:"Maracay aragua veneuzela",
}).then((res)=>{
console.log(res);
}).catch((err)=>{
console.log(err);
})
``
## License
Apache License Version 2.0