【发布时间】:2021-07-20 05:51:15
【问题描述】:
Android 10 以上的大多数设备都支持 Passpoint 配置或 Hostspot 2.0。 但并非所有低于 Android 10 的设备不支持此功能。 有什么方法可以让我们在添加 Passpoint 配置支持之前检查它。
【问题讨论】:
Android 10 以上的大多数设备都支持 Passpoint 配置或 Hostspot 2.0。 但并非所有低于 Android 10 的设备不支持此功能。 有什么方法可以让我们在添加 Passpoint 配置支持之前检查它。
【问题讨论】:
下面的代码 sn-p 将返回设备是否支持 passpoint (Hotspot 2.0) 的结果。 它也适用于 Android 10 以下版本。
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;
}
}
你可以在Blog about passpoint configuration in Android阅读更多关于passpoint配置的信息
【讨论】: