I'm looking to make it clear in my app when the user is not connected to the database, whether that be due to no internet connection on the device or any other means.
I have come up with the following idea and would like any feedback, I feel like this could be unnecessary extra work for the app and the jRDC2 server.
If there are any better ways to achieve this then I will welcome the ideas.
B4X:
Sub Testconnection
Dim j As HttpJob
j.Initialize("", Me)
j.Download("http://192.168.1.21:17178/test")
j.GetRequest.Timeout = 1000
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log(j.GetString)
status.Color = Colors.Green
Else
status.Color = Colors.Red
End If
j.Release
Sleep(5000)
Testconnection
End Sub
You can make the "test" handler simpler and remove the code that gets a connection from the database. Or add a Test2 handler without the SQL connection.
I'm not sure if I'm understanding you correctly?
If I remove the code that gets the connection how will I be checking the connection is ok?
I think I might need to learn a bit more ?
On another note, my solution seems to have its issues. Namely blocking activities from starting as the resumable sub calls itself
you should not remove it. Instead you should create a new handler which does not need a DB connection so the handler is faster ready and faster return a result. Without blocking the Server with a db-connection.
Okay I might be understanding.. maybe
So currently I'm connecting to the jRDC2 server which is then connecting to the database before returning a result.
If I create a handler that only connects to the jRDC2 server, but NOT the database it will be more efficient?
In regards to the resumable sub blocking other activities, is there anything I can do?
I presume its due to the way I've written the sub.
If it calls itself after 'sleep' whilst switching to a different activity the second activity will open and immediately close
Please start a new thread for any new question you have.
Explain everything to help us understand the problem. Best if you upload a small project showing the problem.