dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 129 forks source link

LAUNCH_MODE not being recognized. #187

Closed iget-master closed 6 years ago

iget-master commented 6 years ago

I'm submitting a ... (check one with "x"):

Bug report

Current behavior:

Following the documentation:

{string} launchModeGoogleMaps - (Android only) mode in which to open Google Maps app launchnavigator.LAUNCH_MODE.MAPS or launchnavigator.LAUNCH_MODE.TURN_BY_TURN Defaults to launchnavigator.LAUNCH_MODE.MAPS if not specified.

Setting launchModeGoogleMaps to launchnavigator.LAUNCH_MODE.TURN_BY_TURN doesn't work. It gives me an error saying that launchnavigator.LAUNCH_MODE.TURN_BY_TURN isn't recognized.

Expected behavior:

It should just work as documented!

Steps to reproduce:

Not necessary

Environment information

Cordova CLI: v7.0.1 Cordova platform ls:

Installed platforms:
  android 6.2.3
Available platforms: 
  blackberry10 ~3.8.0 (deprecated)
  browser ~4.1.0
  ubuntu ~4.3.4 (deprecated)
  webos ~3.7.0

Cordova plugin LS

cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-android-permissions 1.0.0 "Permissions"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.7 "Console"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-mauron85-background-geolocation 2.2.5 "CDVBackgroundGeolocation"
cordova-plugin-nativegeocoder 2.0.2 "NativeGeocoder"
cordova-plugin-nativestorage 2.2.2 "NativeStorage"
cordova-plugin-network-information 1.3.3 "Network Information"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-barcodescanner 6.0.7 "BarcodeScanner"
uk.co.workingedge.phonegap.plugin.launchnavigator 4.2.0 "Launch Navigator"
cli packages: (/home/esoares/Sandbox/ionic-cdttravel/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 7.0.1 

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.0.2
Node              : v8.10.0
npm               : 5.6.0 
OS                : Linux 4.13

Environment Variables:

ANDROID_HOME : /home/esoares/android-sdk/

Misc:

backend : legacy

Console output

ERROR Error: Uncaught (in promise): Error: 'launchnavigator.LAUNCH_MODE.TURN_BY_TURN' is not a recognised launch mode Error: 'launchnavigator.LAUNCH_MODE.TURN_BY_TURN' is not a recognised launch mode at Object.ln.util.validateLaunchMode (common.js:843) at Object.ln.navigate (launchnavigator.js:202) at callCordovaPlugin (plugin.js:110) at plugin.js:120 at util.js:22 at new t (polyfills.js:3) at tryNativePromise (util.js:21) at getPromise (util.js:29) at wrapPromise (plugin.js:119) at LaunchNavigator. (plugin.js:238) at Object.ln.util.validateLaunchMode (common.js:843) at Object.ln.navigate (launchnavigator.js:202) at callCordovaPlugin (plugin.js:110) at plugin.js:120 at util.js:22 at new t (polyfills.js:3) at tryNativePromise (util.js:21) at getPromise (util.js:29) at wrapPromise (plugin.js:119) at LaunchNavigator. (plugin.js:238) at c (polyfills.js:3) at polyfills.js:3 at rejected (3.js:24) at t.invoke (polyfills.js:3) at Object.onInvoke (core.es5.js:3890) at t.invoke (polyfills.js:3) at r.run (polyfills.js:3) at polyfills.js:3 at t.invokeTask (polyfills.js:3) at Object.onInvokeTask (core.es5.js:3881)


# Documentation issue This bug may be related with an outdated documentation!
dpa99c commented 6 years ago

This constant is defined in the source code and available at runtime on Android.

Just regression tested the Advanced Example project with Google Maps v9.74.1 on Android and using launchnavigator.LAUNCH_MODE.TURN_BY_TURN causes the Google Maps app to correctly launch in route navigation mode.

Please build and run the Advanced Example to see this working.

iget-master commented 6 years ago

I'm exposing the launchNavigator to console and doing the following test:

> launchNavigator.APP.LAUNCH_MODE.TURN_BY_TURN
VM8397:1 Uncaught TypeError: Cannot read property 'TURN_BY_TURN' of undefined
    at <anonymous>:1:33
(anonymous) @ VM8397:1

As noticed, it fails.

dpa99c commented 6 years ago

launchNavigator.APP.LAUNCH_MODE.TURN_BY_TURN is an incorrect reference; it should be launchnavigator.LAUNCH_MODE.TURN_BY_TURN. Please read the documentation.