Android Question B4Xpages. How do I handle when the OS pauses it?

jimseng

Active Member
Licensed User
Longtime User
Hello. I have a simple socket client connecting to a RPi with a socket listening in a Python script. When I leave my phone alone, eventually the socket disconnects (I log it in the Python script). This is not the same as the screen turning off. I'm unsure what is happening in my B4Xpages app at that moment and how I can tell if I have been disconnected or not. It's just so I can show the appropriate re-connect page when the app resumes. Where do I log the "event" so I can take appropriate action when I wake the phone up some time later?
 

jimseng

Active Member
Licensed User
Longtime User
I am using AsyncStreams. What I am trying to understand is that after a few minutes my Python script detects that the socket ends and I reset it ready for another connection. I want to know if there is an Android event that triggers that termination. I am using B4XPage_Background as a guess but are you saying the Terminated and or Error events are the correct way?
 
Upvote 0

teddybear

Well-Known Member
Licensed User
As Erel said in post #3, you can set a socket disconnected state in the Terminated and Error events. so that you can show the appropriate re-connect page when the app resumes
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…