Other Version Check code stopped working in release mode

Robert Valentino

Well-Known Member
Licensed User
Longtime User
This code

B4X:
Public  Sub Process_Globals
      Public     gPackageName     As String  = "com.BOBs.BBS"
End Sub

Public  Sub Service_Create
   
End Sub

Sub Service_Start(StartingIntent As Intent)
   
       SendVersionRequest(gPackageName)   
End Sub


Sub Service_Destroy
End Sub

#Region VersionCheck
Private Sub SendVersionRequest(packagename As String)
         Dim j As HttpJob
       
         j.Initialize("version_check", Me)
         j.Download2("https://play.google.com/store/apps/details", Array As String("id", packagename))
End Sub

Private Sub VersionComplete(s As String)
   
         Dim m As Matcher = Regex.Matcher("softwareVersion\" & QUOTE & ">([^<]+)</div>", s)   
   
         If  m.Find Then
         Dim MainVersion    As String = Main.gVersionName
         Dim CurrentVersion   As String = m.Group(1)
         
#if Debug
         Log("MainVersion[" &MainVersion &"]  CurrentVersion[" &CurrentVersion &"]")
#end if         
         MainVersion    = MainVersion.Trim
         CurrentVersion  = CurrentVersion.Trim
         
         If  MainVersion.EqualsIgnoreCase(CurrentVersion) = False Then
           CallSubDelayed2(Main, "Version_Check", CurrentVersion)
         Else
           CallSubDelayed2(Main, "Version_Check", "Versions are Equal")           
         End If
       Else
         CallSubDelayed2(Main, "Version_Check", "VersionComplete Find Failed")
         End If
End Sub

Private Sub JobDone (Job As HttpJob)
'       ToastMessageShow("JobName = " & Job.JobName & ", Success = " & Job.Success, True)
         If  Job.JobName = "version_check" Then     
         If  Job.Success = True Then
           VersionComplete(Job.GetString)
         Else
           CallSubDelayed2(Main, "Version_Check", "version_check Job.Success Failed")                   
         End If
       Else
         CallSubDelayed2(Main, "Version_Check", "version_check Failed")         
       End If
       
         Job.Release
End Sub
#end Region

Was working fine (not sure when it stopped - just upgraded to 5.8 Monday)

JobDone Never seems to get called

ALL the code works fine in Debug mode but nothing in either Release Modes

BobVal
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Tried, but when creating a small project (using the code from my project) it works fine.

Something I am doing (somewhere) is eating I assume the message from the queue??? That my sub is not being called.

What should I be looking for... Can't use either debugger because then everything works fine.

I will keep combing the code. Any suggestions??

Would consider sending you the project but this is really huge.

BobVal
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Got it to work but not completely sure what is going on:

This is what I use to have (actually I use to have the BillingManager in the service_create but now is here in Service_start - Either case SendVersionRequest was not returning in Release mode but OK in Debug mode

B4X:
Sub Service_Start(StartingIntent As Intent)
   
       SendVersionRequest(gPackageName)   
       
       gBillingManager.Initialize("BillingManager", gBillingManagerKey)

#if Debug       
  gBillingManager.DebugLogging = True
#end if       
End Sub

So what I did was this

I moved the SendVersionRequest to the BillingSupported routine of BillingManager and Now SendVersionRequest works in Release and Debug

B4X:
#Region BillingManager
Private Sub BillingManager_BillingSupported(Supported As Boolean, Message As String)
       If  Supported Then
         gBillingManager.GetOwnedProducts
       End If
       
       SendVersionRequest(gPackageName)         
End Sub
#end region

I the beginning I use to do the gBillingManager.Initialize in service_create and SendVersionRequest In service_start then I tried both in service_start and flipped flopped them and still nothing SendVersionRequest did not return JobDone in release mode

Only grabbing at straws as I was going for the count did I decided to move SendVersionRequest to BillingSupported

IS it at all possible the BillingSupported and GetOwnedProducts is somehow flushing the JobDone request?

Actually I just moved SendVersionRequest to the end of the OwnedProducts routine (still works in all modes) just to make sure there is not conflict

Your thoughts Erel on what could possibly be going on would be greatly appreciated

Thanks

BobVal
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…