Use reflection.. WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);...