Service Module seems to stop ...

cmweb

Active Member
Licensed User
Longtime User
Hi everybody,

I'm trying to deal with a Service Module.

It seems to work, but from time to time (about 2 Hours after starting), the Service stops without getting a StopService command.

The Service looks like this:

B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim time As Long
   Dim Timer2 As Timer
   Dim n As Notification

End Sub
Sub Service_Create

Timer2.Initialize("Timer2", 1000) ' 1000 = 1 second
Timer2.Enabled = True
time = DateTime.Now
n.Initialize
n.Icon = "icon"
n.Vibrate = False
n.Sound = False

End Sub

Sub Service_Start (StartingIntent As Intent)


End Sub

Sub Service_Destroy

n.Cancel(1)

End Sub

Sub Timer2_Tick
   time2 = DateTime.Now
   timezone = -DateTime.DateParse("01/01/1970 00:00:00")
   time3 = time2 - time - timezone
   n.SetInfo("Parkdauer: " & DateTime.Time(time3), "Startzeit: " & DateTime.Time(time) & " Uhr", Main)
   n.Notify(1)
End Sub

Any ideas why this Service might stop without motivation?

Best regards,

Carsten
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…