Is it possible to programmatically enable wifi on Android 10 devices?

后端 未结 3 784
忘掉有多难
忘掉有多难 2020-12-18 11:04

Since setWifiEnabled is deprecated on Android 10, how does one programatically enable wifi on Android 10 devices?

Is it not possible to programmatically enable wifi

3条回答
  •  春和景丽
    2020-12-18 11:56

    Now in android 10 you can do like this

    Intent panelIntent = new Intent(Settings.Panel.ACTION_INTERNET_CONNECTIVITY);
    startActivityForResult(panelIntent);
    

    ACTION_INTERNET_CONNECTIVITY Shows settings related to internet connectivity, such as Airplane mode, Wi-Fi, and Mobile Data.

    ACTION_WIFI Shows Wi-Fi settings, but not the other connectivity settings. This is useful for apps that need a Wi-Fi connection to perform large uploads or downloads.

    ACTION_NFC Shows all settings related to near-field communication (NFC).

    ACTION_VOLUME Shows volume settings for all audio streams.

提交回复
热议问题