Android Question StartServiceAt, only a question about the operation

nicieri

Active Member
Licensed User
Longtime User
Hi.. one question...

If I have a Service that has a processs that take 10 minutes (for example).. and I have this line..

StartServiceAt("", DateTime.Now + 60 * 1000, True)

When the Service start again.. will suspend the first process? or i will have running 2 process?

I want to know what the operation is ?.

Is it replaced? or does the service work several times? what is going on?

Thanks.
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
When the Service start again.. will suspend the first process?
You will have only one process : the service itself but it will be restarted if already running (it will pass the Service_Start sub again). This means that the service won't pass the Service_Create sub nor the Process_Globals declaration in that service.
Of course, if the service had been killed, then, it will be first being created.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Don´t expect it to work over a long time if you restart the service every minute.
Expect to have much batery drain
 
Upvote 0

nicieri

Active Member
Licensed User
Longtime User
Yes... I'm starting the service every 5 minutes (300 000 miliseconds)

StartServiceAt("", DateTime.Now + 300 * 1000, True)

I have this line in the Service_Start

But for some reason.. after some time.. the service stop and never run again..
 
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
Thinking about your last post : are you really sure the service is stopped (I mean do you have for example recorded some logs at each start of it) ? Perhaps the communications are closed.
That's only a question by curiosity. On my G5 with Oreo, StartserviceAtExact still runs the service each quarter since we have talked about previously. The only difference is that I only store the execution time in a list and have that list. Than I stop the service till the next execution. I'll have to try with a delay of 5 mn, now
 
Upvote 0

nicieri

Active Member
Licensed User
Longtime User
When my Service_Start.. I verify the connection.. if the connection is lost.. then the phone recover the communication.. and send a test.

I can see the test in my server.

The funny thing is that when I have it connected to B4a to see the whole Log, it never fails.
 
Upvote 0

nicieri

Active Member
Licensed User
Longtime User
Ok, my service is stopped... I know also because I connect the phones with USB for see the Log.. and this don't show anything

so.. is stopped..

One question.. if I use StartserviceAtExact() i can fix an exact hour... for example..

I can do something like this???..

.......
StartServiceAtExact(12:30:00)
StartServiceAtExact(12:40:00)
StartServiceAtExact(12:50:00)
StartServiceAtExact(13:00:00)
StartServiceAtExact(13:10:00)
StartServiceAtExact(13:20:00)
.......

If you can, where exactly would you have to put these lines?

This to ensure that it really works...

Is possible?, I need to guarantee the operation (I can not accept that it works in some and not others).

Thanks again.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I can do something like this???..

.......
StartServiceAtExact(12:30:00)
StartServiceAtExact(12:40:00)
StartServiceAtExact(12:50:00)
StartServiceAtExact(13:00:00)
StartServiceAtExact(13:10:00)
StartServiceAtExact(13:20:00)
.......

If you can, where exactly would you have to put these lines?
No. You can however find the next scheduled time: [B4X] Calculating the next scheduled time
 
Upvote 0

rleiman

Well-Known Member
Licensed User
Longtime User
Thinking about your last post : are you really sure the service is stopped (I mean do you have for example recorded some logs at each start of it) ? Perhaps the communications are closed.
That's only a question by curiosity. On my G5 with Oreo, StartserviceAtExact still runs the service each quarter since we have talked about previously. The only difference is that I only store the execution time in a list and have that list. Than I stop the service till the next execution. I'll have to try with a delay of 5 mn, now

Hi,

I see you are starting a service on each quarter and I don't know how to do that. I want to do the same. Can you post the coding you used to do that?

Thanks in advance.
 
Upvote 0
Top