Can WIFI be turned off programmatically

后端 未结 3 2082
孤城傲影
孤城傲影 2021-01-07 02:19

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

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-07 02:52

    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.

提交回复
热议问题