Can WIFI be turned off programmatically

后端 未结 3 1464
悲&欢浪女
悲&欢浪女 2021-01-07 02:49

How can wifi be turned off/on programmatically and do is rooted or system app required for this.

3条回答
  •  情歌与酒
    2021-01-07 03:07

    WIFI_ON is a secure setting; only apps signed by the system firmware will be able to hold the proper permission and adjust it using the SDK.


    UPDATE

    setWifiEnabled() probably supports this, as was pointed out in the comments. I don't see evidence of a permission being required, but if there is one, you'll get a stack trace that should point out what's needed. My apologies for forgetting about this path.

提交回复
热议问题