B4A Tutorial Service Modules - Erel    
Feb 7, 2023   
(6 reactions)   
tags: Services
Basic4android v1.2 adds support for Service modules.
Service modules play an important role in the application... a service module runs in the same process and the same thread as all other code.
It is important to....
As you will soon see a service can also bring a process to the foreground.
Adding a service module is done by choosing Project - Add New Module - Service Module.
The template for new services is:
Sub... are kept as long as the process runs and are accessible from other modules.
Sub Service_Create...
B4A Tutorial Downloading files using Service module - Erel    
Jan 29, 2011   
(2 reactions)
DownloadService service:
'Service module
Sub Process_Globals
Dim HC As HttpClient...It is recommended to use HttpUtils2 instead of this code module. HttpUtils2 is more powerful and is easier to work with.
As discussed in the Services tutorial, some tasks are easier to implement with services than with activities.
In this example we will download an image file with a service and use it for the activity background.
This service can be used to download larger files as well...
B4A Question [Service Module] Device in sleep mode does not work! - Roberto P.    
Nov 4, 2016HI All,
I cannot run a service when the device goes in sleep mode. I tried to use the forum recommendations, including StartServiceAt, but does not work!
Can anyone help me understand how to always run the service: off application and device in sleep.
I attach small project.
I specify that I have included two services just to make trials.
Thanks so much...
B4J Question How do you stop a B4J service module - JackKirk    
Oct 2, 2022The title says it all.
There does not appear to be a StopService in B4J....
link: If you mean a B4XPage then you can’t also destroy module a instance....
link: There’s no service in b4j so you can’t stop it....
B4A Question [SOLVED] - Starting B4XPages from a service module - rleiman    
Dec 1, 2020Greetings,
We have a B4XPages app that includes a service module that starts with #StartAtBoot... that module when the user reboots their phone.
Maybe something like this?
#Region Service Attributes...
link: to variable and calls to sub routines in the service module. We now have the app running perfectly...
link:
There is no such thing. B4XPages is tied to an activity (usually the main activity).
You can "...
link: There is no such thing. B4XPages is tied to an activity (usually the main activity).
You can "...
B4A Question [SOLVED] - B4XPages - Starting service module when phone reboots - rleiman    
Nov 29, 2020Greetings,
I have this code to start a service module when the phone reboots but it doesn't... so the service module will start upon rebooting the phone? The good news is that Android doesn...
link: I'm closing the issue because the original objective was to start our service module when...
link:
You should NOT set StartAtBoot in the Starter Service!
We took that coding out....
link: . The service module has CallSubDelayed statements and variable references in the B4XMainPage so we need...
B4A Question How to change view colors / text on a B4XPage from code present on a code/service module? - amorosik    
Oct 13, 2020I have an app for Android that receives sms
N.1 service module, 3 B4XPage with a command button on each
When sms arrives in the service module I have to change background color, button color, button text on the requested page
How to make code in the service module change these properties of any page?
In general, for the instructions present inside a code module, how to refer to the objects...
link: Don't assume that B4XPages is ready when the message arrives.
If B4XPages.IsInitialized Then
B4XPages.MainPage.DoSomething
End If
...
B4A Question App without Starter service - is it not a default service module ? - amorosik    
Sep 13, 2020On multi pages app example Multi page B4XPages example there is only four modules, Main, B4XMainPage + Page2 + Page3 class module
Where is Starter service?
I thought the Starter module... notifications and sms, where to enter the code to initialize the required services (FirebaseMessage...
link: The IDE tabs only show the "open" modules. No reason to open all modules when a new...
link: it.
Update: I was wrong. It shows starter service in module tab but not the ide tab. That is annoying...
B4A Question How change editText.text value from service module - Lello1964    
Apr 7, 2020I have more edittext in main module:
Main module :
dim EdiText01 as EditText
dim EdiText02... = " text4"
I must change text value from other Class Module
My Module :
EdiText01.text...
link: You could pass the array of text boxes to the class that is doing the updating.
Sub Activity__Cre...
link: Using a Map provides a way to avoid using tags and is a bit more elegant and probably quicker. See t...
link: . It was a Class, not a Service....
B4A Question Service Module? - Erel (first post)    
Aug 26, 2025   
(1 reaction)The purpose of the service is indeed to prevent the OS from killing the process.
The only reason to implement something in the service is if there are cases where the app is started by the service...
link: , the Service module only purpose is being in the foreground to keep the app working even if sent to...
link: service to prevent the OS from killing the process....
link: I have a question regarding the use of Services. I want to make requests to an API and I need my...
Page: 1  
2  
3  
4  
5  
6  
7