Skip to content

Map.isAvailable()

wf9a5m75 edited this page Sep 11, 2014 · 8 revisions

###Check the availability This plugin uses Google Maps Android API v2 and Google Maps SDK for iOS. They are native libraries, not JavaScript. Since Google Map Android API v2 uses some Google APIs, which does not include in the Android open source code, this plugin does not run on some Android which does not have Google Frameworks, such as Amazon Kindle Fire. You can check the availability using plugin.google.maps.Map.isAvailable().

Google Maps SDK for iOS includes all files to run the map in your app, you don't need to worry. plugin.google.maps.Map.isAvailable() passes true always.

document.addEventListener("deviceready", function() {
  // Check the availability of Google Maps Android API v2.
  // Return always true in iOS.
  plugin.google.maps.Map.isAvailable(function(isAvailable, message) {
    if (isAvailable) {
      var map = plugin.google.maps.Map.getMap();
      map.addEventListener(plugin.google.maps.event.MAP_READY, onMapInit);
    } else {
      alert(message);
    }
  });
});

function onMapInit(map) {
  // The google map is available on this device.
}

Join the official community

New versions will be announced through the official community. Stay tune!

Do you have a question or feature request?

Feel free to ask me on the issues tracker.

Or on the official community is also welcome!


New version 2.0-beta2 is available.

The cordova-googlemaps-plugin v2.0 has more faster, more features.

https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/tree/master/v2.0.0/README.md

Clone this wiki locally