Unable to connect to WiFi AP

158 views
Skip to first unread message

Tjerk bij de Leij

unread,
Apr 22, 2021, 4:59:24 AM4/22/21
to DroidScript
Hello,

From my DroidScript App I am unable to connect to my AP. I am using the code below. However, from Android I am able connect to the AP without any problem. 

What can be wrong?

Thanks,

Tjerk


function OnStart()
{
     app.ChooseWifi( "","", onWiFiSelected );
    
}

function onWiFiSelected( ssid )
{
 app.WifiConnect( ssid, "APpassword" );    
    
 app.SetOnWifiChange( OnWifiChange );         
}

function OnWifiChange( state, ssid )
{
    app.ShowPopup( ssid + " " + state );
}

T. Lee

unread,
Apr 22, 2021, 12:02:31 PM4/22/21
to DroidScript
I just tried your code, and it works here. I did have to allow DS to access my device's location, but that was it.

Tjerk bij de Leij

unread,
Apr 23, 2021, 2:42:58 AM4/23/21
to DroidScript
Strange, on my phone location access is enabled and the list displays all the WIFI networks in the neighborhood but does not want to connect to the selected network ;-(

Op donderdag 22 april 2021 om 18:02:31 UTC+2 schreef T. Lee:

Steve Garman

unread,
Apr 23, 2021, 3:17:56 AM4/23/21
to DroidScript
Can I just check the facts are as I understand them so we are testing like for like

1) Your code is in a normal foreground app, not a service

2) Your app is open when you run the code

3) You are running your app in DroidScript, not a built APK

4) Settings > Apps > DroidScript > Permissions > Location
is set to whichever of the following two is available
  Allow
  Allow only while using the app

Can you tell us 
a) the make and model of the device your code is running on
b) the version of Android
c) the version of DroidScript
d) details of your access point

Tjerk bij de Leij

unread,
Apr 23, 2021, 3:26:27 AM4/23/21
to DroidScript
Hi Steve,

Please find my answers below in red

1) Your code is in a normal foreground app, not a service Yes

2) Your app is open when you run the code Yes

3) You are running your app in DroidScript, not a built APK Yes

4) Settings > Apps > DroidScript > Permissions > Location
is set to whichever of the following two is available
  Allow
  Allow only while using the app Yes

Can you tell us 
a) the make and model of the device your code is running on OnePlus 7 Pro
b) the version of Android 10
c) the version of DroidScript 2.02
d) details of your access point ESP32

Thx,

Tjerk

Op vrijdag 23 april 2021 om 09:17:56 UTC+2 schreef steve....@gmail.com:

Jean-Philippe Rey

unread,
Dec 3, 2021, 1:33:07 PM12/3/21
to DroidScript
Any solution found for this problem? I am facing the exact same one with Android 11, Nokia 8.1, premium version of DS.

Dave

unread,
Dec 5, 2021, 5:19:47 PM12/5/21
to DroidScript
The internal Java code for DS uses this option by default when trying to connect - 

wifiConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);

perhaps the ESP32 is not using WPA_PSK?


If you find out which type(s) it's using, I could add it for you in the next beta release
Reply all
Reply to author
Forward
0 new messages