Android Question Continue to connect WiFi even no internet access

Nitin Joshi

Active Member
Licensed User
Longtime User
In my project, i am using ESP8266 as AP. B4A application connects to SSID, set in ESP8266 as AP node. Till now everything is fine, however, initially (first time), I have to open phone's WiFi setting option to permit to continue WiFi connection even No Internet Available (otherwise phone automatically disconnects WiFi) I would like to do it inside my B4A application.
Can anyone help me to know how to do it?

Thanks and regards.
 

Nitin Joshi

Active Member
Licensed User
Longtime User
Hi Erel,
I have referred thread link shared by you, thank you. I have few queries which i want to clear before i implement in my B4A programe.

1) Do i need to mention SSID somewhere in the "Sub PreferWifiRouting As ResumableSub"?
2) Do i need to run this code for every time if SSID is changed?
3) Can you briefly explain logic? Without understanding logic, i am not able to copy and paste in my code.

Thank you.
 
Upvote 0

Nitin Joshi

Active Member
Licensed User
Longtime User
Dear Erel,
Even I received return True from resumableSub "PreferWiFiRouting", i could not achieve my objective i.e. APP can not connect to WiFi as no internet connection available.

Please find attached snapshot of error thrown by APP. Please support
 

Attachments

  • Error Message.JPG
    Error Message.JPG
    90.4 KB · Views: 401
Upvote 0

Nitin Joshi

Active Member
Licensed User
Longtime User
Dear Erel,
Herewith, please find below error log, however, before that I would like to brief about actions in my APP.
1) Connect button in APP connects to AP of ESP8266.
2) When connection is successful, I receive UDP packet from ESP8266.
3) Upon getting UDP packet from ESP8266, "PreferWiFiRouting" is called to connect WiFi without internet. I receive True from "PreferWiFiRouting" however in short period mobile disconnects WiFi meanwhile android message (WiFi has no internet access, connect anyway?) comes and goes.

Error Log.
Logger connected to: HUAWEI BKL-L09
--------- beginning of system
--------- beginning of main
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
main_udp_sent (java line: 3156)
java.net.SocketException: socket failed: ENONET (Machine is not on the network)
at libcore.io.IoBridge.socket(IoBridge.java:662)
at java.net.PlainDatagramSocketImpl.datagramSocketCreate(PlainDatagramSocketImpl.java:197)
at java.net.AbstractPlainDatagramSocketImpl.create(AbstractPlainDatagramSocketImpl.java:93)
at java.net.DatagramSocket.createImpl(DatagramSocket.java:357)
at java.net.DatagramSocket.<init>(DatagramSocket.java:259)
at java.net.DatagramSocket.<init>(DatagramSocket.java:319)
at java.net.DatagramSocket.<init>(DatagramSocket.java:291)
at anywheresoftware.b4a.objects.SocketWrapper$UDPSocket.Initialize(SocketWrapper.java:463)
at Smart.PumpV5.main._udp_sent(main.java:3156)
at Smart.PumpV5.main._local_status_tick(main.java:1535)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:888)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8178)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
Caused by: android.system.ErrnoException: socket failed: ENONET (Machine is not on the network)
at libcore.io.Linux.socket(Native Method)
at libcore.io.ForwardingOs.socket(ForwardingOs.java:217)
at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:370)
at libcore.io.ForwardingOs.socket(ForwardingOs.java:217)
at libcore.io.IoBridge.socket(IoBridge.java:658)
... 19 more
--------- beginning of crash
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
 
Upvote 0

Nitin Joshi

Active Member
Licensed User
Longtime User
Dear Erel, Can you analyse more as APP can not connect due to No Internet Access.

I have to manually (from WiFi setting) give permission to SSID to connect for the first time.
 
Upvote 0

Nitin Joshi

Active Member
Licensed User
Longtime User
Ok Erel, noted with many thanks.

Either I am failing to program or API does not work. Anyway, I will follow manual permission to SSID, thank you.
 
Upvote 0
Top