From 9bc766c26ecce028ab3ed5192f0a512fca40e142 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Tue, 24 Feb 2015 21:34:11 +0100 Subject: [PATCH] Make more API safe-ity. --- .../main/java/me/datenknoten/tueroeffner/MainActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/me/datenknoten/tueroeffner/MainActivity.java b/app/src/main/java/me/datenknoten/tueroeffner/MainActivity.java index 8d81875..2f39474 100644 --- a/app/src/main/java/me/datenknoten/tueroeffner/MainActivity.java +++ b/app/src/main/java/me/datenknoten/tueroeffner/MainActivity.java @@ -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();