Android Question How best to phase out my 'Starter' Service

Cliff McKibbin

Member
Licensed User
Longtime User
Erel's message in

related to a new 'warning' regarding the use of the Starter Service in b4xpages reminds me that I should go ahead and phase out my use of 'Starter'.

My original apps were all built during the original b4a era and then modified to the b4x pages environment.
As such, I made heavy use of the starter service to hold all my common routines. I brought the 'starter' forward to b4x pages as-is.
I had already moved some functions out of starter due to android changes:
a. internally created 'notifications' were deprecated and I changed to use the Google 'alarm'.
b. Google billing routines had to be moved to b4xmainpage.

Currently, in one app 'starter' is 1900 lines and holds stuff like:
1. Global (public) variables
2. setting an internal version number
3. setting screen size and colors
4. Building the initial DB/all tables for a new user
5. Opening the DB.
6. Reading in my tables and storing them in the public fields/arrays/lists
7. Handling all of the actual DB reads/writes
8. Holding the un-trapped error routine
9. Reading/writing to the web
10. Miscellaneous subs such as purging characters before DB writes, formatting output, encrypting DB data, etc.

The structure of my starter is to fire a series of subroutine calls in 'Service_create' to do the initial 'setup'.
The remainder of starter is all subroutines called from 'Service_create' or other activities (pages).

I am looking for guidance as to where best to move these functions.
The options as I see it are:

1. Erel said we could move the un-trapped error routine to 'Main' once we get rid of the starter service, so that is fairly settled. This function, in turn, fires an email to me with the error message log. I expect the email portion of this will have to be placed wherever the other subs are placed (#4 below).
2. The calls to subs that set up tables, open DB, etc would all have to be placed early in b4xmainpage.B4XPage_Created.
3. Public variables. Should they all be in b4xmainpage or in with the subs below?
4. Subs. Should they all be in b4xmainpage or in a new 'code module'?

Any guidance would be helpful.
Thanks, Cliff McKibbin
 

josejad

Expert
Licensed User
Longtime User
Related

 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…