Make more API safe-ity.
This commit is contained in:
parent
806a6d797b
commit
9bc766c26e
1 changed files with 5 additions and 1 deletions
|
@ -160,7 +160,11 @@ public class MainActivity extends ActionBarActivity {
|
|||
|
||||
|
||||
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);
|
||||
wifiManager.disconnect();
|
||||
|
|
Reference in a new issue