dpa99c / phonegap-launch-navigator

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

cordova deviceready not fired after 5 seconds (plugin v4.0.2) #142

Closed daniprofe closed 7 years ago

daniprofe commented 7 years ago

My app hangs at init and never starts (cordova deviceready event not fired). After removing the plugin everything goes ok.

Console log:

deviceready has not fired after 5 seconds. Channel not fired: onCordovaReady Channel not fired: onCordovaInfoReady Channel not fired: onFileSystemPathsReady Channel not fired: onMediaPluginReady Channel not fired: onCordovaConnectionReady

Environment:

OS: Windows 10 64bits node.js 8.1.4 npm 5.0.3 cordova 7.0.1 android platform 6.2.3 phonegap-launch-navigator 4.0.2

Android SDK:

Android SDK Build-Tools 26 Android SDK Platform-Tools 26.0.0 Android SDK Tools 26.0.2 Android Support Library 21.0.3 Android Support Repository 47.0.0 Google Repository 55

Android 7.1.1 (Nougat) - Android SDK Platform 25.3 Android 4.1 (Jelly Bean) - Google APIs 16.4 Android SDK Platform 16.5

dpa99c commented 7 years ago

Just built+run the SimpleExample app in the example repo and it works fine. My build environment, very similar to yours:

OS: Windows 10 64-bit node.js 7.10.0 npm 4.2.0 cordova 7.0.1 android platform 6.2.3 phonegap-launch-navigator 4.0.2

Android SDK:

Android SDK Build-Tools 26 Android SDK Platform-Tools 26.0.0 Android SDK Tools 26.0.2 Android Support Library 23.2.1 Android Support Repository 47.0.0 Google Repository 55

Test device: Android 7.1.1 (Nougat) - Android SDK Platform 25.3

Please build+run one of the example apps in the example repo to eliminate external causes in your code/other plugins.

daniprofe commented 7 years ago

Hi again.

I cloned your example repo, built "SimpleExample" app and installed it on my "problematic" device.

The app starts, so you're right: some other plugin I'm using has an incompatibility with Launch Navigator. This is the list of the plugins I'm actually using and their versions:

com-sarriaroman-photoviewer 1.1.10 "PhotoViewer" com.unarin.cordova.beacon 3.4.0 "Proximity Beacon Plugin" cordova-plugin-actionsheet 2.3.3 "ActionSheet" cordova-plugin-backbutton 0.3.0 "Backbutton" cordova-plugin-ble-central 1.1.4 "BLE" cordova-plugin-camera 2.4.1 "Camera" cordova-plugin-compat 1.1.0 "Compat" cordova-plugin-console 1.0.7 "Console" cordova-plugin-device 1.1.6 "Device" cordova-plugin-dialogs 1.3.3 "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-globalization 1.0.7 "Globalization" cordova-plugin-inappbrowser 1.7.1 "InAppBrowser" cordova-plugin-ios-longpress-fix 1.1.0 "iOS LongPress Fix" cordova-plugin-media 3.0.1 "Media" 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-transport-security 0.1.2 "App Transport Security" cordova-plugin-whitelist 1.3.2 "Whitelist" cordova.plugins.diagnostic 3.4.1 "Diagnostic" onesignal-cordova-plugin 2.1.2 "OneSignal Push Notifications" phonegap-plugin-barcodescanner 6.0.7 "BarcodeScanner" phonegap-plugin-mobile-accessibility 1.0.5-dev "Mobile Accessibility" pushwoosh-cordova-plugin 6.5.3 "Pushwoosh" uk.co.workingedge.phonegap.plugin.launchnavigator 4.0.2 "Launch Navigator"

As I said the SimpleExample app is starting ok, but when I type a destination and tapo on "Navigate" button... nothing happens, and nothing is logged into console.

Another detail I didn't report on my first message: my app didn't start on two devices: one of them has Android 4.2.2, and the the other one has Android 4.4.2. In other devices with Android versions > 4.x the app starts and runs perfect.

Thanks in advance for your help. Regards from a spanish cordova app developer,

Dani

dpa99c commented 7 years ago

Hi Dani,

I've just been having a look at this and I think I found the problem on Android 4:

v4 of this plugin introduces a dependency on localforage as a means of storing persistent state (i.e. the user's preferred app), however this issue indicates that localforage requires the promise API whether or not you use its promise API. Subsequently, since I am not using the promise API, I have used localforage.nopromises.js in v4 of this plugin, but on Android 4.x system browser, there is no native promise API (from Android 5+ it exists natively in the browser).

The Android 4.4 console shows me:

Uncaught module lie/polyfill not found cordova.js:59
deviceready has not fired after 5 seconds. cordova.js:1223
Channel not fired: onCordovaReady cordova.js:1216

Therefore I think the solution may be to include the full localforage.js which contains a polyfill for promises. I will try this out and, if it fixes the problem, publish a patch version to fix this bug.

dpa99c commented 7 years ago

Yes, this was the case and I've published the fix in v4.0.3

daniprofe commented 7 years ago

Great! Now with v4.0.3 of your plugin is working perfect! Thanks for your help!

I sent you a donation, enjoy a beer with my best regards

Dani a.k.a "daniprofe"

dpa99c commented 7 years ago

Hi Dani, thanks for reporting this and thanks for the beer!