diff options
author | Stephan Merker <merker.stephan@googlemail.com> | 2012-03-27 23:25:27 +0200 |
---|---|---|
committer | Stephan Merker <merker.stephan@googlemail.com> | 2012-03-27 23:25:27 +0200 |
commit | 097f175ac26fdc0f33da79c391e36e9b4a3d1925 (patch) | |
tree | 1ab5fd95b80b7b9e40e91178c2f7aaab6eed2db2 /main | |
parent | cf4c2a7447b7f0df3699eaf84a3d19e53184df01 (diff) | |
download | cgeo-097f175ac26fdc0f33da79c391e36e9b4a3d1925.zip cgeo-097f175ac26fdc0f33da79c391e36e9b4a3d1925.tar.gz cgeo-097f175ac26fdc0f33da79c391e36e9b4a3d1925.tar.bz2 |
make google maps api optional so that cgeo runs on x86 emulator
- x86 system images in virtualization mode allows much faster dev
cycles (since SDK r17)
- GoogleMapProvider is added only if google map api is detected at
run time
Diffstat (limited to 'main')
-rw-r--r-- | main/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/maps/MapProviderFactory.java | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/main/AndroidManifest.xml b/main/AndroidManifest.xml index ff9ddeb..bcb4fa7 100644 --- a/main/AndroidManifest.xml +++ b/main/AndroidManifest.xml @@ -22,7 +22,7 @@ android:label="@string/app_name" android:icon="@drawable/cgeo" android:backupAgent="cgeo.geocaching.backup.CentralBackupAgent" > - <uses-library android:name="com.google.android.maps" /> + <uses-library android:name="com.google.android.maps" android:required="false" /> <meta-data android:name="android.app.default_searchable" android:value=".cgeoadvsearch" /> diff --git a/main/src/cgeo/geocaching/maps/MapProviderFactory.java b/main/src/cgeo/geocaching/maps/MapProviderFactory.java index c7865f3..c7c85f5 100644 --- a/main/src/cgeo/geocaching/maps/MapProviderFactory.java +++ b/main/src/cgeo/geocaching/maps/MapProviderFactory.java @@ -20,7 +20,14 @@ public class MapProviderFactory { private SortedMap<Integer, String> mapSources; private MapProviderFactory() { - mapProviders = new MapProvider[] { new GoogleMapProvider(GOOGLEMAP_BASEID), new MapsforgeMapProvider(MFMAP_BASEID) }; + // add GoogleMapProvider only if google api is available in order to support x86 android emulator + try { + Class.forName("com.google.android.maps.MapActivity"); + mapProviders = new MapProvider[] { new GoogleMapProvider(GOOGLEMAP_BASEID), new MapsforgeMapProvider(MFMAP_BASEID) }; + } catch (ClassNotFoundException e) { + mapProviders = new MapProvider[] { new MapsforgeMapProvider(MFMAP_BASEID) }; + } + mapSources = new TreeMap<Integer, String>(); for (MapProvider mp : mapProviders) { mapSources.putAll(mp.getMapSources()); |