Android Question Service.StartForeground, stopped?

nicieri

Active Member
Licensed User
Longtime User
Hi, I have a Service with a timer that check every 5 minutes a TCP connection.

I started this service with StartForeground, and all works good,.. the problem is in some phones.. like newest.. the service in some moment (after some hours) is stopped..

In other devices the same build is working perfectly.

Some idea?

Thanks.


Sub Service_Create
..
Service.StartForeground(0,n)
PWS.PartialLock
....
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
Got another idea : why not restarting the collection service at interval using StartServiceAtExact ? It has an option to allow starting while the device is sleeping...
 
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
So, proposition #1 : excluding from battery optimization..
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top