Rafael T
Rafael T

Reputation: 15689

GoogleMapsV2 OpenGL issue

I'm currently switching from the old GoogleMaps API to the newer V2 one. I refactored the old logic and it works perfectly. Because I support 2.1 devices as well, I want to leave the old Map as legacy solution for older devices or devices without PlayStore. I tested a lot of devices before I came to the HTC-Wildfire. this device was delegated to the MapsV2 but shows a blank white screen only. I suspect that it cannot render the new Map because it lacks support for OpenGlES.

This is the code I use to determine which Maps Version should get shown:

int availCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
            switch (availCode) {
            case ConnectionResult.SUCCESS:
                addTab(TAB_GOOGLE_MAPS, R.string.tab_google_map, R.drawable.tab_surrounding, GoogleMapsActivityV2.class, true);
                break;
            case ConnectionResult.SERVICE_MISSING:
            case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
            case ConnectionResult.SERVICE_DISABLED:
                GooglePlayServicesUtil
                .getErrorDialog(availCode, this, REQUEST_CODE_PLAY_SERVICES)
                .show();
                break;
            case ConnectionResult.SERVICE_INVALID:
            default:
                addTab(TAB_GOOGLE_MAPS, R.string.tab_google_map, R.drawable.tab_surrounding, GoogleMapsActivity.class, true);
                break;
            }

So it has GooglePlayServices Support, but obviosly this check isn't enaugh. Is it possible to check for a supported OpenGL-ES Version? What should I check to make shure MapsV2 is runnig? I cannot define a requiresFeature openGLES tag inside the manifest, because I have a legacy fallback, and dont want to exclude lower-end devices or users which don't like the PlayStore.

Upvotes: 0

Views: 67

Answers (1)

CSmith
CSmith

Reputation: 13458

This does a programmatic check for OpenGL/ES 2 support:

// Check device configuration to ensure OpenGL ES 2.0 support
ActivityManager am = (ActivityManager)activity.getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo config = am.getDeviceConfigurationInfo();
if (config.reqGlEsVersion < 0x20000)
{
 addTab(TAB_GOOGLE_MAPS, R.string.tab_google_map, R.drawable.tab_surrounding, GoogleMapsActivity.class, true);
}
else
{
 ... check for Play Services...
}

You can also require OpenGL/ES 2 support via your app manifest:

<uses-feature android:glEsVersion="0x00020000" android:required="true" />

though this would conflict with your desire to support Android 2.1.

Upvotes: 1

Related Questions