You should be able to do it in Android 4.2 make sure you have the permission
android.permission.CHANGE_WIFI_STATE
and we cannot help you unless you post your code.
I believe this will help you check if tethering is active
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); Method[] methods = wifiManager.getClass().getDeclaredMethods(); for (Method method : methods) { if (method.getName().equals("setWifiApEnabled")) { try { method.invoke(wifiManager, null, enable); } catch (Exception ex) { } break; } }
沒有留言:
張貼留言