If you want to distribute (out of the Market) a Trial version of yor App to a circle of persons and you don't know how many installations and who is really testing it, how can you stop all those installations at the same time?
I've tried to solve using HttUtils (not sure if I used it the right way). I've loaded to a webserver a single text file (here named 'yourFile.txt') that contains the text 'OK'. As long as 'yourFile.txt' contains 'OK' trial Apps work. If you change 'OK' to something else, Trial Apps stop working.
But I've noticed one thing (still due to my not understanding 100% httpUtils): If you change the content of 'yourFile.txt', trial versions continues working for a while because, I suppose, it reads 'OK' from the cache (I think it acts like the licensing protection of the Market). They work till the cache is not empty or you turn the phone Off. It's not a big problem, but if I could manage it better I would prefer.
I know, it is not a 100% secure method, but enough for my needs.
I just want to know if my code (from Erel's example) is correct or if somethings is wrong/missing. Thank you.
I've tried to solve using HttUtils (not sure if I used it the right way). I've loaded to a webserver a single text file (here named 'yourFile.txt') that contains the text 'OK'. As long as 'yourFile.txt' contains 'OK' trial Apps work. If you change 'OK' to something else, Trial Apps stop working.
But I've noticed one thing (still due to my not understanding 100% httpUtils): If you change the content of 'yourFile.txt', trial versions continues working for a while because, I suppose, it reads 'OK' from the cache (I think it acts like the licensing protection of the Market). They work till the cache is not empty or you turn the phone Off. It's not a big problem, but if I could manage it better I would prefer.
I know, it is not a 100% secure method, but enough for my needs.
I just want to know if my code (from Erel's example) is correct or if somethings is wrong/missing. Thank you.
B4X:
'Activity module
Sub Process_Globals
Dim b4a As String
b4a = "http://yourWebServerName/yourDir/yourFile.txt"
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Activity.LoadLayout("yourLayout")
ProgressDialogShow("connecting...")
HttpUtils.CallbackActivity = "Main" 'Current activity name.
HttpUtils.CallbackJobDoneSub = "JobDone"
HttpUtils.Download("Job1", b4a)
End Sub
Sub Activity_Resume
'Check whether a job has finished while the activity was paused.
If HttpUtils.Complete = True Then JobDone(HttpUtils.Job)
End Sub
Sub UrlDone(Url As String)
Log("URLDONE " &Url & " done")
End Sub
Sub JobDone (Job As String)
Dim s As String
If HttpUtils.IsSuccess(b4a) Then
s = HttpUtils.GetString(b4a)
If s="OK" Then
ProgressDialogHide
Msgbox("Trial is "&s,"AppTitle")
Else
ProgressDialogHide
Msgbox("Trial out of date.","AppTitle")
Activity.Finish
End If
Else
ProgressDialogHide
Msgbox("Connection error,"&CRLF&"try again later.","AppTitle")
Activity.Finish
End If
HttpUtils.Complete = False
End Sub
Last edited: