MAP_READY event not fired
I'm submitting a ... (check one with "x")
- [ ] question
- [x] any problem or bug report
- [ ] feature request
If you choose 'problem or bug report', please select OS: (check one with "x")
- [x] Android
- [ ] iOS
cordova information: (run $> cordova plugin list)
cordova-plugin-browsertab 0.2.0 "cordova-plugin-browsertab"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-firebase 1.0.5 "Google Firebase Plugin"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-googlemaps 2.2.9 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-vibration 3.1.0 "Vibration"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova.plugins.diagnostic 4.0.7 "Diagnostic"
onesignal-cordova-plugin 2.4.0 "OneSignal Push Notifications"
If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)
This is my package.json
{
"name": "whereismybike",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/animations": "5.2.10",
"@angular/common": "5.2.10",
"@angular/compiler": "5.2.10",
"@angular/compiler-cli": "5.2.10",
"@angular/core": "5.2.10",
"@angular/forms": "5.2.10",
"@angular/http": "5.2.10",
"@angular/platform-browser": "5.2.10",
"@angular/platform-browser-dynamic": "5.2.10",
"@ionic-native/browser-tab": "^4.7.0",
"@ionic-native/camera": "^4.7.0",
"@ionic-native/core": "4.7.0",
"@ionic-native/diagnostic": "^4.7.0",
"@ionic-native/firebase": "^4.7.0",
"@ionic-native/geolocation": "^4.7.0",
"@ionic-native/globalization": "^4.7.0",
"@ionic-native/google-maps": "4.7.0",
"@ionic-native/in-app-browser": "^4.7.0",
"@ionic-native/network": "^4.7.0",
"@ionic-native/onesignal": "^4.7.0",
"@ionic-native/splash-screen": "4.7.0",
"@ionic-native/status-bar": "^4.7.0",
"@ionic-native/vibration": "^4.7.0",
"@ionic/storage": "2.1.3",
"cordova-android": "7.1.0",
"cordova-plugin-browsertab": "^0.2.0",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-firebase": "^1.0.5",
"cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-googlemaps": "^2.2.9",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-vibration": "^3.1.0",
"cordova-plugin-whitelist": "^1.3.3",
"cordova.plugins.diagnostic": "^4.0.7",
"firebase": "^4.13.1",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"ng2-translate": "^5.0.0",
"onesignal-cordova-plugin": "^2.4.0",
"rxjs": "5.5.10",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.9",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-camera": {},
"cordova-plugin-vibration": {},
"cordova-plugin-browsertab": {},
"cordova-plugin-firebase": {},
"onesignal-cordova-plugin": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-globalization": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-network-information": {},
"cordova.plugins.diagnostic": {},
"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
},
"cordova-plugin-googlemaps": {
"API_KEY_FOR_ANDROID": "AIzaSyAMJZQkbwaw-vPOmMbcs0mx-2IGk35Ha-s",
"API_KEY_FOR_IOS": "AIzaSyDoVrwVoH7iNoqPnvOywwiljO2CMCSfmoo",
"PLAY_SERVICES_VERSION": "15.0.1",
"ANDROID_SUPPORT_V4_VERSION": "26.1.0"
}
},
"platforms": [
"android"
]
}
}
Current behavior: The application worked fine, but since yesterday the MAP_READY event is not fired anymore. I receive the 'Google maps created!' log but don't get the 'Google maps ready!' log. Since I receive no error messages it is hard to find a solution. I expect it would be something with an auto updated plugin.
Expected behavior: The application should show the google map.
Related code, data or error log (please format your code or data): src/providers/native-map-container.ts
this.map = GoogleMaps.create(document.getElementById("map"), mapOptions);
console.log('Google maps created!');
this.map.one(GoogleMapsEvent.MAP_READY) // --> event never fired
.then(() => {
console.log('Google maps ready!');
this.map.setClickable(false);
this.map.setCompassEnabled(false);
this.map.setTrafficEnabled(false);
this.map.setIndoorEnabled(false);
this.addUserToMap();
this.addDevicesToMap();
this.map.setClickable(true);
//this.hasShown = true;
this.map.setClickable(true)
}).catch(error => console.log(error));
Are you sure you are on version 2.2.9? It has not changed recently. There was a commit yesterday on the master branch it might have caused the issue but definitely not on v2.2.9.
Referring to this issue... https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2270
At first, you should update this plugin library to latest version.
Use instead of document.getElementById("map"):
@ViewChild('mapdiv') mapdiv: ElementRef;
GoogleMaps.create(this.mapdiv.nativeElement);
I am also reporting this same issue on android 4.4.4 and back. The MAP_READY never gets called.
here is a zip with @battika 's suggestion too and did not seem to work. map-test.zip
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.9
Cordova Platforms : android 7.0.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
ios-deploy : 1.9.2
ios-sim : 6.1.2
Node : v8.9.4
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.3.1 Build version 9E501
Environment Variables:
ANDROID_HOME : /Users/*/Library/Android/sdk
Misc:
backend : pro
I was using the latest version before
cordova-plugin-googlemaps 2.3.3 "cordova-plugin-googlemaps"
but then I got this error:
FAILURE: Build failed with an exception.
* What went wrong:
FAILED
Execution failed for task ':app:compileDebugJavaWithJavac'.
>
Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info
or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED
in 10s
27 actionable tasks: 6 executed, 21 up-to-date
(node:4378) UnhandledPromiseRejectionWarning: Error: /home/arnoud/Documents/webstorm/whereismybike/platforms/android/gradlew: Command failed with exit code 1 Error output:
/home/arnoud/Documents/webstorm/whereismybike/platforms/android/app/src/main/java/plugin/google/maps/PluginStreetViewPanorama.java:17: error: cannot find symbol
import com.google.android.gms.maps.model.StreetViewSource;
^
symbol: class StreetViewSource
location: package com.google.android.gms.maps.model
/home/arnoud/Documents/webstorm/whereismybike/platforms/android/app/src/main/java/plugin/google/maps/PluginStreetViewPanorama.java:87: error: cannot find symbol
StreetViewSource source = "OUTDOOR".equals(cameraOpts.getString("source")) ?
^
symbol: class StreetViewSource
location: class PluginStreetViewPanorama
/home/arnoud/Documents/webstorm/whereismybike/platforms/android/app/src/main/java/plugin/google/maps/PluginStreetViewPanorama.java:88: error: cannot find symbol
StreetViewSource.OUTDOOR : StreetViewSource.DEFAULT;
^
symbol: variable StreetViewSource
location: class PluginStreetViewPanorama
/home/arnoud/Documents/webstorm/whereismybike/platforms/android/app/src/main/java/plugin/google/maps/PluginStreetViewPanorama.java:88: error: cannot find symbol
StreetViewSource.OUTDOOR : StreetViewSource.DEFAULT;
^
symbol: variable StreetViewSource
location: class PluginStreetViewPanorama
/home/arnoud/Documents/webstorm/whereismybike/platforms/android/app/src/main/java/plugin/google/maps/PluginStreetViewPanorama.java:280: error: cannot find symbol
StreetViewSource source = "OUTDOOR".equals(cameraOpts.getString("source")) ?
^
symbol: class StreetViewSource
/home/arnoud/Documents/webstorm/whereismybike/platforms/android/app/src/main/java/plugin/google/maps/PluginStreetViewPanorama.java:281: error: cannot find symbol
StreetViewSource.OUTDOOR : StreetViewSource.DEFAULT;
^
symbol: variable StreetViewSource
/home/arnoud/Documents/webstorm/whereismybike/platforms/android/app/src/main/java/plugin/google/maps/PluginStreetViewPanorama.java:281: error: cannot find symbol
StreetViewSource.OUTDOOR : StreetViewSource.DEFAULT;
^
symbol: variable StreetViewSource
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
7 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 10s
at ChildProcess.whenDone (/home/arnoud/Documents/webstorm/whereismybike/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at ChildProcess.emit (events.js:160:13)
at maybeClose (internal/child_process.js:943:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:4378) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4378) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I didn't found a solution on this so that's why I downgraded to 2.2.9.
Google Play Services SDK version is old.
@wf9a5m75 how to update the Google Play Services then in Ionic?
ah, it has been written zillion times on this forum. You are using onesignal that will block you from using it easily.
https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2272 Use this thread for reference. This is what I did and I am using Ionic too.
--variable PLAY_SERVICES_VERSION="15.0.1"
Oke thanks for the quick replies !