Android Question Service Module?

Maxcfgos

New Member
I have a question regarding the use of Services. I want to make requests to an API and I need my application continue working in the background. From the Service, I can't directly access the EditText (for example) to check their text, so how could I establish this connection? I've already read the documentation but I still don't fully understand it.
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
1. Use B4XPages.
2. Implement everything in B4XMainPage or any other page.
3. Start a foreground service to prevent the OS from killing the process.

if I understand correctly, in this architecture, the Service module only purpose is being in the foreground to keep the app working even if sent to background.
this is done for ease of satisfying the requisite of updating a View (EditText in this case).
if this was not a requisite, is there a reason for not having the actual code in the Service module itself?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
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. Something that was more useful in the past, and now is quite restricted in latest versions of Android.
 
Upvote 0

Similar Threads

Top