androidpermissionsandroid-10.0android-go

How to detect Android Go?


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.


Solution

  • 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();
        }