Fixed WIFI SSID not shown in csv log

This commit is contained in:
Ziver Koc 2014-08-11 11:49:44 +02:00
parent 99c21bf92b
commit 0a05a6b69c
3 changed files with 23 additions and 10 deletions

View file

@ -115,7 +115,7 @@ public class CSVWriter {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if(netInfo == null)
return "";
return "n/a";
if(netInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
TelephonyManager telMan = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
@ -144,7 +144,7 @@ public class CSVWriter {
return data.toString();
}
return "";
return "n/a";
}
private static String getCellId(CellInfo cell){
int cid = Integer.MAX_VALUE;
@ -158,7 +158,7 @@ public class CSVWriter {
cid = ((CellInfoLte) cell).getCellIdentity().getCi();
if(cid == Integer.MAX_VALUE)
return "UNKNOWN";
return "n/a";
else
return ""+cid;
}
@ -166,13 +166,13 @@ public class CSVWriter {
private static String getSSID(Context context){
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if(netInfo == null || netInfo.getType() == ConnectivityManager.TYPE_WIFI)
return "";
if(netInfo == null || netInfo.getType() != ConnectivityManager.TYPE_WIFI)
return "n/a";
WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wm.getConnectionInfo();
if(wifiInfo == null)
return "";
return "n/a";
return wifiInfo.getSSID().replace("\"", "");
}