Android Question Avoid sending messages to waitng queue

Fusseldieb

Active Member
Licensed User
Longtime User
Hi all,
is there a way to disable that B4A sends messages to waiting queue?
Because it is making a big mess here.

Log:
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = false **
** Activity (activity2) Create, isFirst = false **
running waiting messages (1)
** Activity (activity2) Resume **
** Activity (activity2) Pause, UserClosed = true **
sending message to waiting queue (jobdone)
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = false **
** Activity (activity2) Create, isFirst = false **
running waiting messages (1)
** Activity (activity2) Resume **
** Activity (activity2) Pause, UserClosed = true **
sending message to waiting queue (jobdone)
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = false **
** Activity (activity2) Create, isFirst = false **
running waiting messages (1)
** Activity (activity2) Resume **
** Activity (activity2) Pause, UserClosed = true **
sending message to waiting queue (jobdone)
sending message to waiting queue (CallSubDelayed - JobDone)
running waiting messages (1)
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = false **
** Activity (activity2) Create, isFirst = false **
running waiting messages (1)
** Activity (activity2) Resume **
** Activity (activity2) Pause, UserClosed = true **
sending message to waiting queue (CallSubDelayed - JobDone)
sending message to waiting queue (jobdone)
running waiting messages (1)
** Activity (activity1) Resume **

Thanks :)
 

Fusseldieb

Active Member
Licensed User
Longtime User
I don't want to run events in the background, I want to cancel the events.

Following code doesn't work at all.
B4X:
StopService("")
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I don't want to run events in the background, I want to cancel the events.

Your mainpurpose was to suppress the reactivating your activity when a jobdone event is raised even if your app still has been exited.
Doing the httpjobs in a service has the advantage that it can run in background even if your activity is exited. But when the jobdone event is raised (in your service (not your activity)) you then can decide what to to with the data you get in jobdone.
You can check if your activity is already running:
- If it is still running then you can raise a event in your activity to give over the result from webservice
- If your activity is already exited (user leaves) then you just dont raise an event. You can also check how many jobs are still running. And if there is no more job running then you can savety stop the service
 
Upvote 0
Top