Search code examples
ioscordovaphonegap

Cordova 10/11 iOS app not able to open google maps URI


After upgrading to cordova 11 from cordova 9, I am unable to open a google maps URI (On Button click Cordova app should open Google maps with the co-cordinates)

What worked in cordova 9:

var coord = lat + ',' + lon;
window.open(`comgooglemaps://${coord}?q=${coord}`, `_system`);

Ref: https://developers.google.com/maps/documentation/urls/ios-urlscheme

Now, this does nothing. No errors or logs.

Working config: Cordova 9, cordova-ios 5.1.1

Current config: Cordova 11, cordova-ios 6.2.0


Solution

  • My issue was with the installed InAppBrowser plugin.

    I've previously done as they suggested:

    window.open = cordova.InAppBrowser.open; 
    

    But this no longer seems to work. As soon as I changed the code to use InAppBrowser explicitly:

    window.cordova.InAppBrowser.open(`comgooglemaps://${coord}?q=${coord}`, _system); 
    

    it started working again.