Make more API safe-ity.

This commit is contained in:
Tim Schumacher 2015-02-24 21:34:11 +01:00
parent 806a6d797b
commit 9bc766c26e

View file

@ -160,7 +160,11 @@ public class MainActivity extends ActionBarActivity {
WifiConfiguration wifiConfig = new WifiConfiguration(); WifiConfiguration wifiConfig = new WifiConfiguration();
wifiConfig.SSID = String.format("\"%s\"", networkSSID); if (Build.VERSION.SDK_INT > 17) {
wifiConfig.SSID = String.format("\"%s\"", networkSSID);
} else {
wifiConfig.SSID = networkSSID;
}
int netId = wifiManager.addNetwork(wifiConfig); int netId = wifiManager.addNetwork(wifiConfig);
wifiManager.disconnect(); wifiManager.disconnect();