disable httpClient_responseSucess

Penko

Active Member
Licensed User
Longtime User
Hello!

I have a strange "problem". I don't want to track the responseSucess Event because I don't care much if the http query will be processed correctly or not. If you are interested - it's kinda Trial mode however mine is for statistics purposes and doesn't limit the use of applications.

So, I have a Code Module called Track

B4X:
Sub CallHome(mode As String, additional As String)

Try

If(Common.InternetEnabled) Then

Dim final_string, params As String

params = createUserData(mode, additional)

final_string = Common.activation_link & params

Common.httpClient1.Initialize("httpClient1")

    Common.httprequest1.InitializeGet(final_string)
    Common.httprequest1.Timeout = 50000
   
    If Common.HttpClient1.Execute(Common.httprequest1, 1) = False Then
       Return False
    End If
   
   Else
   
   Return False
   
   End If
   
   Catch
   
   If(Common.debug_mode) Then
      Common.LogT("Call Home: " & LastException, "")
   End If
   
      Return False
   
   End Try
   
   Return True
   
   
End Sub

My problem is that there is no way to disable the responseSuccess event. I dunno why but B4A is still searching for it even if I pass "" as a parameter. The result java error reffers to the method "_responseSuccess" without any prefix variable.

I succeed in tricking B4A by defining httpClient11 as a Global Variable at every Activity module I have a call to Track.CallHome. Then, I just implement a blank httpClient1_responseSuccess event which does the trick.

I am not sure what would happen If we disable these java errors but they are very useful.

Erel, my two cents, check out this "bug" please.
 

Penko

Active Member
Licensed User
Longtime User
Erel, I define httpClient in my CallHome method which is in my Track code module.

I am calling this method in several activities so I can't define it in Activity. Provided that I don't care about the result, isn't there way I get rid of the httpResponseSuccess?



Sent from my HTC Desire using Tapatalk
 
Upvote 0

timo

Active Member
Licensed User
Longtime User
B4X:
Sub CallHome(mode As String, additional As String)

Penko, a little bit out of your question, but how can your 'CallHome' return true or false if it isn't declared to return boolean or anything else?
(In this case you can only use 'return' to exit the sub)
 
Last edited:
Upvote 0

Penko

Active Member
Licensed User
Longtime User
You seem right, I have missed that. It was intended for use if I am to check the execution status but I simply don't care about the status. Actually the Tracker module became quite good. It does exactly what it should. It reports application opens, add clicks and websitr redirects to my backend. If you are interested, I can share the source code. It is you that inspired me with your efforts. Tomas(XVer....)s example was using his AdvancedCamera library and wasn't applicable. Mine is inside a code module.

Sent from my HTC Desire using Tapatalk
 
Upvote 0

timo

Active Member
Licensed User
Longtime User
I dont know if I understood it correcltly, but is it not enough to simply write 'Return' under ResponeseSuccess and ResponseError in a usual code?
 
Last edited:
Upvote 0
Top