Hi all,
I have services that needs to be running all the time. Or rather wake up with StartServiceAt.
I used this code at first...
The problem is that it gives a notification sound/vibration every time I start the app.
So I tried this...
This works. No sound or vibration at startup.
But is this a correct way to do it?
Will this service never be killed?
I know the forgroundservice in the first example must give a notificaton since it's Foreground and I don't mind the icon showing. I will use notifications myself in the app BUT I don't want the phone to vibrate and give a sound every time the app starts.
I have services that needs to be running all the time. Or rather wake up with StartServiceAt.
I used this code at first...
B4X:
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS
The problem is that it gives a notification sound/vibration every time I start the app.
So I tried this...
B4X:
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER
lock.PartialLock
' And in Service_Destroy:
lock.ReleasePartialLock
CancelScheduledService(Me)
This works. No sound or vibration at startup.
But is this a correct way to do it?
Will this service never be killed?
I know the forgroundservice in the first example must give a notificaton since it's Foreground and I don't mind the icon showing. I will use notifications myself in the app BUT I don't want the phone to vibrate and give a sound every time the app starts.