How do I On/Off wifi of my user?

I create an app and in that app I need to On/Off wifi of my user. How I do this?

And also,

Note : starting from Android 10, this method does not work anymore, see also this stackoverflow answer. For Android 10 you might want to try this Activity Starter solution.

thanks @Alaqmar_Bohori

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.