Android Question Service runs throughout the day but doesn't run the next day


Licensed User
Longtime User

I know services are covered alot on here and I have tried to follow the updated examples (Location Tracker etc) however I cannot understand why my app which sends simple notifications based on a list of times via a service will run fine every hour (or whatever interval I set) during the day however the next day the service doesn't fire anymore until I open the app again.

The FindNextSchedule part works fine, I've used the FindNextTime and SetHours examples from this forum and I can see in the log that the next scheduled time is always correct. From the main, I'm simply calling StartService(ServiceName) and this is my service:

    Sub Service_Start (StartingIntent As Intent)
    Dim t = FindNextSchedule As Long 'will be 13:13, then 14:13 for example
    Dim n As Notification
    n.Vibrate = True
    n.AutoCancel = True
    n.icon = "icon"
    n.SetInfo("Test", DateTime.Time(DateTime.Now), Main)
    StartServiceAt(Me, t, True)
End Sub

Referring to the post here:

I've tried using
Service.StopAutomaticForeground after the StartServiceAt call however that didn't seem to do anything. I don't want a persistent app icon/notification, just the one which is delivered by the service which will keep running as per its next scheduled run time. The custom service is StartAtBoot=False and has global variables, initially supplied the Main sub. Is what I'm wanting possible? Even when I tried it with StartAutomaticForeground and changed my phone time to the next day, the notification still didn't appear?