diff options
| author | SammysHP <sven@sammyshp.de> | 2013-08-22 17:17:11 +0200 |
|---|---|---|
| committer | SammysHP <sven@sammyshp.de> | 2013-08-22 17:17:11 +0200 |
| commit | 2d84b218fc0213bb3c7fba91a30186b2cfd952ea (patch) | |
| tree | 2348fda5e183c6a910c20ae99496305250778396 | |
| parent | 4b1d34d382117b8af27fb012518ac9381a315c17 (diff) | |
| download | cgeo-2d84b218fc0213bb3c7fba91a30186b2cfd952ea.zip cgeo-2d84b218fc0213bb3c7fba91a30186b2cfd952ea.tar.gz cgeo-2d84b218fc0213bb3c7fba91a30186b2cfd952ea.tar.bz2 | |
Log warning if Google API key not available
| -rw-r--r-- | main/src/cgeo/geocaching/maps/MapProviderFactory.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/maps/MapProviderFactory.java b/main/src/cgeo/geocaching/maps/MapProviderFactory.java index f3f3960..84c9329 100644 --- a/main/src/cgeo/geocaching/maps/MapProviderFactory.java +++ b/main/src/cgeo/geocaching/maps/MapProviderFactory.java @@ -7,6 +7,7 @@ import cgeo.geocaching.maps.interfaces.MapProvider; import cgeo.geocaching.maps.interfaces.MapSource; import cgeo.geocaching.maps.mapsforge.MapsforgeMapProvider; import cgeo.geocaching.settings.Settings; +import cgeo.geocaching.utils.Log; import org.apache.commons.lang3.StringUtils; @@ -30,16 +31,20 @@ public class MapProviderFactory { public static boolean isGoogleMapsInstalled() { // Check if API key is available - boolean googleMaps = StringUtils.isNotBlank(cgeoapplication.getInstance().getString(R.string.maps_api_key)); + if (StringUtils.isBlank(cgeoapplication.getInstance().getString(R.string.maps_api_key))) { + Log.w("No Google API key available."); + return false; + } // Check if API is available try { Class.forName("com.google.android.maps.MapActivity"); } catch (ClassNotFoundException e) { - googleMaps = false; + return false; } - return googleMaps; + // Assume that Google Maps is available and working + return true; } public static List<MapSource> getMapSources() { |
