Android Question How do I handle network errors when they occur?

davepamn

Active Member
Licensed User
Longtime User
The application runs several hours and after which it can not access machines on the network using wifi, nor can the tablet ping external machines.
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Maybe you could provide more information to help identify the issue? What does the app do? Are there any error messages when it stops communicating on the network? Does the app crash?

It could be something as simple as the device turning off WiFi when it there is no user / network activity for a certain amount if time. Have you set the KeepAlive?

B4X:
Private ws As PhoneWakeState

ws.KeepAlive(True)

This will stop the phone going to sleep & turning off the WiFi while your app is running. Don't forget to call ws.KeepAlive(False) to release it when your app is finished.

- Colin.
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
I have
B4X:
Tablet.KeepAlive(True)
in the code.

The 4G does not have a problem, the wifi, does
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
I have
B4X:
Tablet.KeepAlive(True)
in the code.

The 4G does not have a problem, the wifi, does
You're not really doing much to assist us in helping you. If you really want help figuring this out, you're going to have to provide more information. You can start by answering the questions in my first post. It might also help if you upload the project, or at least the code you have written to handle the network part.

- Colin.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
My phone is connected to WiFi when I get home from work 'till the other morning. All Google services and apps like WhatsApp stay connected via WiFi. So this not a WiFi issue. Maybe there is something with your code. Can other machines (which you try to ping) still connect to devices?

Some phones/tablets with a crappy Android version (like china brands or CM builds) may have issues with the WiFi connection (software).
 
Upvote 0
Top