Hey All,
I'm working on a project that requires the tablet to refresh the screen without user input if data changes. How I've implemented it is a field in the database that, if set to '1', will trigger a call to the refresh button that is available to the user. If RefreshBtn is pressed, the first thing it does is goes to the database and sets the flag to '0'. This is all handled within a check refresh subroutine that polls the database every variable (currently 10) seconds. The problem I have is that it works just fine when I'm debugging and have the tablet connected via bridge, but once I put the code in Release mode and copy it over to another tablet, the refresh never happens. The database flag stays set to '1'. If I do a manual refresh, the flag is set to '0'.
Any insights would be helpful.
Here's my subroutine.
I'm working on a project that requires the tablet to refresh the screen without user input if data changes. How I've implemented it is a field in the database that, if set to '1', will trigger a call to the refresh button that is available to the user. If RefreshBtn is pressed, the first thing it does is goes to the database and sets the flag to '0'. This is all handled within a check refresh subroutine that polls the database every variable (currently 10) seconds. The problem I have is that it works just fine when I'm debugging and have the tablet connected via bridge, but once I put the code in Release mode and copy it over to another tablet, the refresh never happens. The database flag stays set to '1'. If I do a manual refresh, the flag is set to '0'.
Any insights would be helpful.
Here's my subroutine.
B4X:
Sub refresh_check
Log(refreshtimer * 1000) ' currently set to 10 (seconds)
Do While 1 = 1
Log("tick")
Sleep(refreshtimer * 1000) '60000 = 1 min
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("check_refresh", Array(prepid, jdgnumber))
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
Dim row() As Object = res.Rows.Get(0)
If row(0) = 1 Then
Log("do refresh")
Refresh_Click
End If
End If
j.release
Loop
End Sub