Is there any way to detect that device is running Android Go edition? Need to determine if device is capable of providing SYSTEM_ALERT_WINDOW
since API 29.
According the reference, Settings.canDrawOverlays(Context context)
will always return false on API 29 Go. Without knowing if the system is possible to give access to SYSTEM_ALERT_WINDOW
it's hard to work around the case.
You'll need to know your Android version for a lot of different reasons, like troubleshooting or finding features. To see what version of Android you're using, go to "Settings > About phone/device > Software Information/Android Version.
Android Go, officially Android (Go Edition), is a stripped-down version of the Android operating system, designed for low-end and ultra-budget smartphones. It is intended for smartphones with less than 2 GB of RAM and was first made available for Android Oreo.
More and more Android Go devices have recently been introduced in various markets around the globe, and now you can get Android Go installed on pretty much any device that currently runs on Android.
So, to put it plainly: Android One is a line of phones—hardware, defined and managed by Google—and Android Go is pure software that can run on any hardware. There aren't specific hardware requirements on Go like on One, though the former is designed explicitly for lower-end hardware.
ActivityManager am = (ActivityManager) context.getSystemService(ACTIVITY_SERVICE);
am.isLowRamDevice();
The following code is available in ActivityManager.java
/**
* Returns true if this is a low-RAM device. Exactly whether a device is low-RAM
* is ultimately up to the device configuration, but currently it generally means
* something with 1GB or less of RAM. This is mostly intended to be used by apps
* to determine whether they should turn off certain features that require more RAM.
*/
public boolean isLowRamDevice() {
return isLowRamDeviceStatic();
}
You can refer to the implementation of the Android 11 source code.
It only uses ActivityManager.isLowRamDevice()
to check if the SYSTEM_ALERT_WINDOW
permission is available.
packages\apps\Settings\src\com\android\settings\Utils.java
/**
* Returns true if SYSTEM_ALERT_WINDOW permission is available.
* Starting from Q, SYSTEM_ALERT_WINDOW is disabled on low ram phones.
*/
public static boolean isSystemAlertWindowEnabled(Context context) {
// SYSTEM_ALERT_WINDOW is disabled on on low ram devices starting from Q
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
return !(am.isLowRamDevice() && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q));
}
You can simply query PackageManager
to check if one of the Android GO preloaded apps is installed, as they have different package names.
For example:
Gmail Go package name: "com.google.android.gm.lite"
Regular Gmail package name: "com.google.android.gm"
fun isGoDevice(): Boolean {
val GMAIL_GO_PACKAGE_NAME = "com.google.android.gm.lite"
val packageManager = context.getPackageManager()
return try {
packageManager.getPackageInfo(GMAIL_GO_PACKAGE_NAME, 0)
true
} catch (e: PackageManager.NameNotFoundException) {
false
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With