[android] #2421 - Adding check in case Wifi Status isn't granted to keep app from crashing

This commit is contained in:
Brad Leege
2016-02-07 09:12:07 -06:00
parent b4c7ab83bd
commit 60ab3e3af0

View File

@@ -220,9 +220,14 @@ public class MapboxEventManager {
String status = "No";
WifiManager wifiMgr = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
if (wifiMgr.isWifiEnabled()) {
WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
if( wifiInfo.getNetworkId() != -1 ){
status = "Yes";
try {
WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
if( wifiInfo.getNetworkId() != -1 ){
status = "Yes";
}
} catch (Exception e) {
Log.w(TAG, "Error getting Wifi Connection Status: " + e);
status = "Unknown";
}
}