In my Android 11 TvBox rooted, I prepared an action in Macrodroid, in order to connect to a not saved WiFI SSID, using Javascript.
This Javascripot was written by ChatGPT, since I am not proficient at all in this language:
List<String> wifiList = WifiManagerCompat.getScanResults(context)...