Search code examples
androidandroid-cameraandroid-wifiandroid-bluetooth

How to permanently disable Wi-Fi, Bluetooth and USB Mass Storage in Android


I'm working on an Android app which requires to disable WiFi, Bluetooth and Mass Storage options.

I've seen some apps like Timeriffic and ProfileScheduler. These apps will help disable the certain features like bluetooth and WiFi. But they will only change put them on/off.

In my case I want to completely disable them and then they are not available for user.

I would like to know is there any API in Android which will allow us to completely disable the these features???


Solution

  • Not a perfect solution... but for a work around, you can listen for state of wifi. Use ConnectionManager

    Whenever wifi is turned on.. You can disconnect it via code..

    WifiManager wifiManager = (WifiManager)this.context.getSystemService(Context.WIFI_SERVICE);
    wifiManager.setWifiEnabled(false);
    

    :D