Following the "threading library thread" i have now this basic service
Now, I have read (and see) that this library has problems in debug mode and I should compile my code as a library. Are these steps correct ?
1) create a blank project, with just this service module
2) compile it as library
3) include the library in my real project
4) from my real project, use startservice("test")
I'm a bit confused: do I reaaly need a service ? Is it better to simply create a code module and compile it as library ?
How to call this module and pass also some parameters ?
B4X:
Sub Process_Globals
Dim Thread1 As Thread
End Sub
Sub Service_Create
Thread1.Initialise("Thread1")
End Sub
Sub Service_Start (StartingIntent As Intent)
Dim args(2) As Object
args(0)=1
args(1)="hello"
Thread1.Name = "B4A Thread 1"
Thread1.Start(Null, "Thread_Sub1", args)
End Sub
Sub Service_Destroy
End Sub
Sub Thread_Sub1(x As Int, a As String)
Log(x)
Log(a)
End Sub
Sub Thread1_Ended(EndedOk As Boolean, error As String) 'An error or Exception has occurred in the Thread
Log(error & " - Thread1 Ended")
Log(EndedOk)
StopService("")
End Sub
Now, I have read (and see) that this library has problems in debug mode and I should compile my code as a library. Are these steps correct ?
1) create a blank project, with just this service module
2) compile it as library
3) include the library in my real project
4) from my real project, use startservice("test")
I'm a bit confused: do I reaaly need a service ? Is it better to simply create a code module and compile it as library ?
How to call this module and pass also some parameters ?