Android Question "auto refresh" Android tablet

AKJammer

Active Member
Licensed User
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.
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
 

AKJammer

Active Member
Licensed User
Oh Man!! That was it!!

if 1 = row(0)

I remember seeing something a couple years ago that Erel said to put the constant first. This is the first time that was an issue.

Thanks!!
 
Upvote 0

AKJammer

Active Member
Licensed User
That was the code before I found the timer object, I was making my own. One statement is a Log, the other is a sleep. The comments are just that. '60000 = 1 min
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…