Android Question Background services

Nizze

Active Member
Licensed User
Longtime User
Hi all

I have been playing with Erels Websocket push .

And i have noticed som difference in what phones i use.
When i use my newest Huawei P20 ( android 8.0.0) everything works as expected.
But on another device running Android 7.1.2 it does not work the same way .

The problem is the service module the stops working .
I have in the service module :

B4X:
#Region  Service Attributes
    #StartAtBoot: true
    #StartCommandReturnValue: android.app.Service.START_STICKY
#End Region

And i have been trying different : Service.XXXX in Service_Start

If i use :
B4X:
StartServiceAt(Me, DateTime.Now + 2 * DateTime.TicksPerMinute, False)
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS
'Service.StartForeground(0,Null)


Then it seems to work okey , but i get a notificaton sound everytime the services is restarted.
wich is enoying .
Can u disable that sound ?

Or is there another way to keep the service alive ?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top