The Maps v2 documentation states:
Because version 2 of the Google Maps Android API requires OpenGL ES version 2, you must add a
<uses-feature>
element as a child of themanifest
element in AndroidManifest.xml:<uses-feature android:glEsVersion="0x00020000" android:required="true"/>`
This notifies external services of the requirement. In particular, it has the effect of preventing Google Play Store from displaying your app on devices that don't support OpenGL ES version 2.
In fact, it throws an exception
if this is not in the manifest. I don't want to filter my app in the store, I plan to keep using the old maps for old devices, and only show the new maps if the required features are present, detected at runtime rather than before installation.
So how do I do that? Does it have to be something like multiple APKs
with different manifests
?
Final Update
As of 2013/12/20, the Android Dashboard shows that approximately 100% of devices now support OpenGL 2.0+ so this answer is no longer relevant. You may simply require OpenGL ES 2.0+ in your manifest.
Update
This is fixed as of rev 7 of the Google Play Services SDK add-on. It is safe to use
<uses-feature android:glEsVersion="0x00020000" android:required="false"/>
and to detect OpenGL ES 2.0 at runtime.Original answer
It appears that the Google Maps Android API v2 requires an explicit
<uses-feature android:glEsVersion="0x00020000" android:required="true/>
declaration inAndroidManifest.xml
so there is no way to deploy Google Maps Android API v2 services without excluding all OpenGL ES 1.x devices. At the time of this writing, Google's Android Dashboard shows that, among 1.1 and 2.0 devices, 90.8% of devices support 2.0.On a particular device (Motorola XOOM), this code results in
supportsEs2 = true
:However, when there is no
<uses-feature>
declaration in the manifest, MapFragment is throwing a RuntimeException:Here's to hoping that an update to the Maps library will remove this limitation so we can deploy a single APK and use runtime APIs to determine whether or not to load the new Google Maps v2 experience or fall back to another compatible solution.
I had the same problem, looked around and most of the suggested workaround for the emulator didn't work for me. Then i found a post were the Genymotion emulator was suggested. This emulator supports OpenGL ES version 2. It is also much faster than the standard emulator.
This is fixed and will be release with next release of Maps Android API as mentioned in issue #4699