Is there a way to check if Android device supports openGL ES 2.0?

Erik Sapir picture Erik Sapir · Feb 8, 2012 · Viewed 29.1k times · Source

I need to check dynamically if the used device supports openGL ES 2.0. How can i do that?

Answer

Foggzie picture Foggzie · Feb 8, 2012

Yes. The following code will do the trick:

final ActivityManager activityManager = 
    (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = 
    activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

Read this for more info: http://www.learnopengles.com/android-lesson-one-getting-started/

You may also require want to restrict devices that don't support 2.0 from seeing your app in the marketplace by adding the following to your manifest:

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

See also the doc of uses-feature.