J jkhazraji Active Member Licensed User Longtime User Apr 18, 2017 #1 in a code line like the following: Code: StartServiceAt("", DateTime.Now + 1000, True) 'will start after one seconds. can this lead to overloading of the device processor or memory since it calls the service every single second even during sleep?
in a code line like the following: Code: StartServiceAt("", DateTime.Now + 1000, True) 'will start after one seconds. can this lead to overloading of the device processor or memory since it calls the service every single second even during sleep?
Erel B4X founder Staff member Licensed User Longtime User Apr 18, 2017 #2 It is better to use a timer for short intervals. You should call Service.StartForeground if you want the service to keep running in the background. Upvote 0
It is better to use a timer for short intervals. You should call Service.StartForeground if you want the service to keep running in the background.
J jkhazraji Active Member Licensed User Longtime User Apr 18, 2017 #3 Thanks..Is it necessary to start the service from the "Main" module or the "Starter" service before calling Service.StartForeground or it will start automatically ? Code: Sub Process_Globals Dim n AsNotification End Sub Sub Service_Create n.Initialize . . . n.SetInfo("Title", "Body", Main) End Sub Sub Service_Start (StartingIntent AsIntent) Service.StartForeground(1, n) End Sub NB : Code is taken from another thread Last edited: Apr 18, 2017 Upvote 0
Thanks..Is it necessary to start the service from the "Main" module or the "Starter" service before calling Service.StartForeground or it will start automatically ? Code: Sub Process_Globals Dim n AsNotification End Sub Sub Service_Create n.Initialize . . . n.SetInfo("Title", "Body", Main) End Sub Sub Service_Start (StartingIntent AsIntent) Service.StartForeground(1, n) End Sub NB : Code is taken from another thread
J jkhazraji Active Member Licensed User Longtime User Apr 18, 2017 #4 I found the answer in https://www.b4x.com/android/forum/threads/service-startforeground-change-strings.56719/ It is YES. Upvote 0
I found the answer in https://www.b4x.com/android/forum/threads/service-startforeground-change-strings.56719/ It is YES.