Service and Timer

GaNdAlF89

Active Member
Licensed User
Longtime User
I have a problem with a timer in a service module. The timer is initialized (to a minute, with 60000 value) in Service_Create and it is enabled in Service_Start. In the Tick event of timer, it saves the gps coordinates (I use the gps_service) in a database. When the app is running, it writes correctly the coordinates every minute (as expected) but when I press on the power button it writes coordinates every 2,3,5 or more minutes. What is the problem? I have already used the PhoneWakeState1.KeepAlive(True).

Anyhow, can you explain to me the difference between "PhoneWakeState1.KeepAlive(True)" and "PhoneWakeState1.PartialLock" ?
 

GaNdAlF89

Active Member
Licensed User
Longtime User
I tried this solution: in Service_Start I enable the timer, at the end of the Timer_Tick function I disable the timer and I call StartServiceAt, so that it re-enable the timer and so on...What do you think about this solution? Thanks
 
Upvote 0
Top