mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 916 forks source link

Fails to display on Android 9 Pie (no error) #2664

Closed kelvindart-certua closed 5 years ago

kelvindart-certua commented 5 years ago

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

OS: (check one with "x")

cordova information: (run $> cordova plugin list)

cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-firebase-analytics 2.0.4 "FirebaseAnalyticsPlugin"
cordova-plugin-googlemaps 2.6.2 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.1 "cordova-plugin-ionic-webview"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
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-telerik-imagepicker 2.3.3 "ImagePicker"
cordova-plugin-transport-security 0.1.2 "App Transport Security"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 3.2.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
cordova-support-android-plugin 1.0.1 "cordova-support-android-plugin"
cordova-support-google-services 1.3.1 "cordova-support-google-services"

ionic info:

Ionic:

   Ionic CLI                     : 5.2.3 (/Users/kelvindart/.nvm/versions/node/v10.16.0/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.7.1
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 19 other plugins)

Utility:

   cordova-res : 0.6.0 
   native-run  : 0.2.8 

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.1
   NodeJS     : v10.16.0 (/Users/kelvindart/.nvm/versions/node/v10.16.0/bin/node)
   npm        : 6.10.1
   OS         : macOS Mojave
   Xcode      : Xcode 10.3 Build version 10G8

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)

@ionic-native/core : 5.11.0
@ionic-native/google-maps : 5.5.0

Current behavior: I have the Google Maps plugin installed which seems to work fine on iOS, but not on Android (a div renders and is set to the desired height, but it has no content inside of it where the map should display). I am running it on a Samsung Galaxy S10 running Android 9 Pie.

I have no errors displayed on the console, and I have tried to debug it. It seems to reach this line, and then stops execution: https://github.com/mapsplugin/cordova-plugin-googlemaps/blob/master/src/android/plugin/google/maps/PluginMap.java#L277

options.camera(builder.build());

I have no idea why execution stops after here.

Expected behavior: For the map to render.

Screen capture or video record:

Screenshot 2019-07-30 at 11 10 40 Screenshot 2019-07-30 at 11 10 40

Related code, data or error log (please format your code or data):

const mapOptions: GoogleMapOptions = {
  mapType: 'MAP_TYPE_NORMAL',
  camera: {
    target: { // London lat and lng
      lat: 51.509865,
      lng: -0.118092
    },
    zoom: 5,
    tilt: 100
  }
};

// initialize map
this.googleMap = GoogleMaps.create(this.localMap.nativeElement, mapOptions);

this.googleMap.one(GoogleMapsEvent.MAP_READY)
  .then(() => {
      console.log('Map ready!');

      // -->Create: marker
      const lat = this.address.latitude;
      const lng = this.address.longitude;

      // -->Market: add all
      this.googleMap.addMarker({
        title: 'Test Marker Title',
        icon: 'red',
        position: { lat: +lat, lng: +lng }
      });

      // set view of the map based on options
      this.googleMap.moveCamera({
          target: { lat: +lat, lng: +lng },
          zoom: 14,
          tilt: 0
      });
  })
  .catch(err => {
    console.error('GMAP ERROR: ', err);
  });

This code does work on iOS.

Support this plugin activity

I appreicate if you give me a beer :beer: from here

kelvindart-certua commented 5 years ago

Actually, I'm just installing the Google Play Services SDK - I feel it might be related... 🙂

kelvindart-certua commented 5 years ago

Unfortunately installing the Google Play SDK wasn't related - it still didn't render the map after I had the SDK installed.

wf9a5m75 commented 5 years ago

GoogleMapsMapTypeId.ROADMAP https://github.com/ionic-team/ionic-native-google-maps/blob/master/documents/maptype/README.md

kelvindart-certua commented 5 years ago

Hey @wf9a5m75 - just tried it by providing GoogleMapsMapTypeId.ROADMAP and no luck - it's still blank. 😢

wf9a5m75 commented 5 years ago

Okay, please share your project files on GitHub repository.

kelvindart-certua commented 5 years ago

Thanks @wf9a5m75 - I'll create an isolated project (due to NDAs on the product). I'll let you know when created, and link it here.

kelvindart-certua commented 5 years ago

Hey @wf9a5m75 - I've produced an example repository which you can find here: https://github.com/kelvindart-certua/ionic-googlemaps-issue. You can set up the project by:

  1. Cloning: git clone git@github.com:kelvindart-certua/ionic-googlemaps-issue.git
  2. npm i to install dependencies
  3. Insert Google API keys for Android/iOS here in config.xml
  4. ionic cordova run android --device to run on an Android device

I tried updating the Google Maps CocoaPod to 3.3.0 but no joy, unfortunately. I don't have access to an older Android device, so unable to confirm if it's version related. Also, the project above runs ok on iOS (I have omitted the MapType again, but tried various things including/omitting various key/values).

I have blanked out the API keys, for obvious reasons: https://github.com/kelvindart-certua/ionic-googlemaps-issue/blob/master/config.xml#L102-L103.

If you need anything my end, or for me to test anything, please let me know!

wf9a5m75 commented 5 years ago

The problem is tilt value. tilt value range is from 0 to 90.

kelvindart-certua commented 5 years ago

Hi @wf9a5m75 - that's awesome - thanks so much. Apologies, I didn't realise at all. I will rectify this in my code and try it out.

On your approval, shall I raise a PR so that out-of-bound values are set to a default? Or is this behaviour you don't think the plugin should be responsible for?