I'm taking hidden SSID and password as input from the user, where I don't know its security type, so I'm not able to connect to that wifi if it has a password when I send the Security type as SECURITY_NONE. Can you help me how to proceed further by making any changes in my approach.

          private fun connectToWifi(password: String) {
                     val ssid = binding.inputSSID.text.toString().trim()
                     val accessPointDetails = AccessPointDetails(
                     ssid,
                     "",        //BSSID
                     password,
                     "",        //Security Type
                     true       //hidden SSID
                    ) 
                    val action = ManualWifiConnectFragmentDirections.
                                  actionManualWifiConnectFragmentToConnectWithPasswordFragment(
                                  WIFI_MODE_PASSWORD_BASED.SCAN, accessPointDetails)

                  findNavController().navigate(action)

          }
0

There are 0 best solutions below