PhilipBrown Active Member Licensed User Longtime User Feb 21, 2021 #1 Does this have any practical use? Should it be documented?
Erel B4X founder Staff member Licensed User Longtime User Feb 21, 2021 #2 It is shortly explained here: https://www.b4x.com/android/forum/t...framework-for-managing-multiple-pages.118901/ It is a simple placeholder. You can store whatever you like there. The use case is with cross platform apps that can start in the background. For example after they receive a push notification. In that case B4XPages will not be initialized but B4XPages.GlobalContext will still be available (if assigned properly when the app starts, in the starter service in B4A). Code: Copy Sub Message_Received Starter.SQL.DoSomething 'not cross platform Dim sql As SQL = B4XPages.GlobalContext 'cross platform sql.DoSomething Upvote 0
It is shortly explained here: https://www.b4x.com/android/forum/t...framework-for-managing-multiple-pages.118901/ It is a simple placeholder. You can store whatever you like there. The use case is with cross platform apps that can start in the background. For example after they receive a push notification. In that case B4XPages will not be initialized but B4XPages.GlobalContext will still be available (if assigned properly when the app starts, in the starter service in B4A). Code: Copy Sub Message_Received Starter.SQL.DoSomething 'not cross platform Dim sql As SQL = B4XPages.GlobalContext 'cross platform sql.DoSomething
PhilipBrown Active Member Licensed User Longtime User Feb 21, 2021 #3 Many thanks. The page https://www.b4x.com/android/forum/t...framework-for-managing-multiple-pages.118901/ does not actually mention GlobalContext so is not found in a search of the Forum. Last edited: Feb 21, 2021 Upvote 0
Many thanks. The page https://www.b4x.com/android/forum/t...framework-for-managing-multiple-pages.118901/ does not actually mention GlobalContext so is not found in a search of the Forum.
M Mahares Expert Licensed User Longtime User Feb 21, 2021 #4 PhilipBrown said: does not actually mention GlobalContext Click to expand... The last paragraph of post#1 of that link makes mention of it. Upvote 0
PhilipBrown said: does not actually mention GlobalContext Click to expand... The last paragraph of post#1 of that link makes mention of it.
PhilipBrown Active Member Licensed User Longtime User Feb 21, 2021 #5 Mahares said: The last paragraph of post#1 of that link makes mention of it. Click to expand... In fact that page talks about B4XPages.B4XGlobalContext not B4XPages.GlobalContext. I note also it talks about initializing it in Service_Create of the starter service, but in fact B4XPages.GlobalContext can hold standard variables with being initialized. Upvote 0
Mahares said: The last paragraph of post#1 of that link makes mention of it. Click to expand... In fact that page talks about B4XPages.B4XGlobalContext not B4XPages.GlobalContext. I note also it talks about initializing it in Service_Create of the starter service, but in fact B4XPages.GlobalContext can hold standard variables with being initialized.
Erel B4X founder Staff member Licensed User Longtime User Feb 22, 2021 #6 PhilipBrown said: In fact that page talks about B4XPages.B4XGlobalContext not B4XPages.GlobalContext. Click to expand... Fixed. PhilipBrown said: I note also it talks about initializing it in Service_Create of the starter service, but in fact B4XPages.GlobalContext can hold standard variables with being initialized. Click to expand... That's true. It can hold whatever you like. It does make sense to initialize that object in Service_Create of the starter service. This way it will be available in all cases. Upvote 0
PhilipBrown said: In fact that page talks about B4XPages.B4XGlobalContext not B4XPages.GlobalContext. Click to expand... Fixed. PhilipBrown said: I note also it talks about initializing it in Service_Create of the starter service, but in fact B4XPages.GlobalContext can hold standard variables with being initialized. Click to expand... That's true. It can hold whatever you like. It does make sense to initialize that object in Service_Create of the starter service. This way it will be available in all cases.