Skip to content
Advertisement

How can we check whether the device support HS2.0(Hotspot 2.0) or Passpoint Configuration in Android?

Most of the devices above Android 10 is supporting the Passpoint Configuration or Hostspot 2.0. But not all Lower than Android 10 devices not supporting this functionality. Is there any way so that we can check for Passpoint Configuration support before adding it.

Advertisement

Answer

Below code snippet will return result that whether the device is supporting passpoint (Hotspot 2.0) or not. It is also work well with below Android 10 versions.

    public boolean checkHS2Support(Context context) {
    wifiManager = (WifiManager) context.getSystemService(WIFI_SERVICE);
    if (wifiManager != null) {
        try {
            //If below line doen't throw exception then device is support Passpoint(Hotspot2.0)
            //If it return emptyList or List of Saved passpoints then device support Passpoint (Hotspot 2.0)
            List<PasspointConfiguration> listPasspointConfiguration = wifiManager.getPasspointConfigurations();
            if (listPasspointConfiguration != null && !listPasspointConfiguration.isEmpty()) {
                Log.e("ModuleName", "Device Support Passpoint(Hotspot 2.0)");
                Log.e("ModuleName", "passpoint configuration list is available)");
                return true;
            }else{
                Log.e("ModuleName", "Device Support Passpoint(Hotspot 2.0)");
                Log.e("ModuleName", "passpoint configuration list is empty)");
                return true ;
            }
        } catch (Exception ex) {
            Log.e("ModuleName", "Device Does not Support Passpoint(Hotspot 2.0)");
            return false;
        }
    } else {
        Log.e("ModuleName", "Problem in fetching wifi Manager,Make sure to use application context");
        return false;
    }
}

You can read more about passpoint configuration in Blog about passpoint configuration in Android

5 People found this is helpful
Advertisement