Starter service is not the correct place for such code. Implement it in a class.
Yes, Erel, that's what I suggested in the first answer, but where to instantiate the class?
In that answer I suggested, looking at your tutorial, in the B4XMainPage but then I noticed that this does not necessarily have to be the first to show:
This page will usually be the first one to be displayed.
and that this "property" exists:
13. There is a field named B4XPages.B4XGlobalContext. The use case behind it is with a class instance that is initialized in Service_Create of the starter service. This can be a good place to implement tasks that can also run in the background.
which seems to be made just for this purpose.
So where to instantiate a global class, an "utility singletone", which will certainly be instantiated "immediately" and accessible from anywhere? B4XMainPage or B4XPages.GlobalContext ("here" you cannot instantiate your class, you could only assign your object to it. After this last sentence of mine, I think the answer is obvious: B4XMainPage).