C Creideiki Active Member Licensed User Longtime User Jan 31, 2019 #1 I want to create a class, and an instance of it has to be available for all activities as process_global at all time. As I have understood I have to declare it in any sub Process_Globals. But what is best practice to initialize it? One way would be like here: https://www.b4x.com/android/forum/t...ss-in-process_global-error.19758/#post-115243 But then I have to call Init in every Activity (and service?). What about the Starter Service? Would it be save to initialize the instance here? If I don't stop the service it shoud be active as long as the whole process isn't killed, shouldn't it?
I want to create a class, and an instance of it has to be available for all activities as process_global at all time. As I have understood I have to declare it in any sub Process_Globals. But what is best practice to initialize it? One way would be like here: https://www.b4x.com/android/forum/t...ss-in-process_global-error.19758/#post-115243 But then I have to call Init in every Activity (and service?). What about the Starter Service? Would it be save to initialize the instance here? If I don't stop the service it shoud be active as long as the whole process isn't killed, shouldn't it?
Erel B4X founder Staff member Licensed User Longtime User Jan 31, 2019 #2 The starter service is the best place for it. Initialize it in Service_Create. Creideiki said: If I don't stop the service it shoud be active as long as the whole process isn't killed, shouldn't it? Click to expand... Yes. Upvote 0
The starter service is the best place for it. Initialize it in Service_Create. Creideiki said: If I don't stop the service it shoud be active as long as the whole process isn't killed, shouldn't it? Click to expand... Yes.