How to check if Android supports openGL ES2.0 or later.
This article explains the way and example code in Kotlin.
Table of Contents
Way to check GLES version
You can retrieve Android GLES version by the below code.
Example code in Kotlin :
val activityManager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager val configurationInfo = activityManager.getDeviceConfigurationInfo() val glesVersion = configurationInfo.reqGlEsVersion
Check if supports GLES2.0
Simply determine if the version is greater than 0x20000.
Example code in Kotlin :
private fun supportGles2(): Boolean{ val activityManager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager val configurationInfo = activityManager.getDeviceConfigurationInfo() return configurationInfo.reqGlEsVersion >= 0x20000 }
Restrict devices not support GLES2.0
If you want to restrict devices that don’t support openGL ES2.0 from seeing your app in the GooglePlay, add the following to your app’s AndroidManifest.xml
Add the following to AndroidManfest.xml :
<uses-feature android:glEsVersion="0x00020000" android:required="true" />