marcick Well-Known Member Licensed User Longtime User Nov 5, 2012 #1 HI all, I have a service that intercept incoming SMS and I use Code: Copy Service.StartForeground to prevent the service is killed form the OS. So the service run forever, but happens (rarely but happens) that it is killed again. I'm thinking to use Code: Copy StartServiceAt("", DateTime.Now + 60 * DateTime.TicksPerSecond, True) But to be really useful I would need to specify a very short time of 10 seconds or less. I wonder if this could have some negative effects (resources, power consumption, I don't know). Also, what happens when the scheduled event raisebut the service is already running ? Is the code in service_start executed again ? (and how eventually to avoid it) ? Marco
HI all, I have a service that intercept incoming SMS and I use Code: Copy Service.StartForeground to prevent the service is killed form the OS. So the service run forever, but happens (rarely but happens) that it is killed again. I'm thinking to use Code: Copy StartServiceAt("", DateTime.Now + 60 * DateTime.TicksPerSecond, True) But to be really useful I would need to specify a very short time of 10 seconds or less. I wonder if this could have some negative effects (resources, power consumption, I don't know). Also, what happens when the scheduled event raisebut the service is already running ? Is the code in service_start executed again ? (and how eventually to avoid it) ? Marco
Erel B4X founder Staff member Licensed User Longtime User Nov 5, 2012 #2 Have you seen this tutorial: Intent Filters - Intercepting SMS messages in the background Upvote 0
marcick Well-Known Member Licensed User Longtime User Nov 5, 2012 #3 Yes Erel, but I didn't consider it because I need to capture SMS and decide if pass them or not to the SMS manager. If I have read well, this is not possible with static receiver. Marco Upvote 0
Yes Erel, but I didn't consider it because I need to capture SMS and decide if pass them or not to the SMS manager. If I have read well, this is not possible with static receiver. Marco
djpero Member Licensed User Longtime User Nov 5, 2012 #4 You can use in combination: * SMS_RECEIVE intent to start service * SMS intercept lib to decide what with sms Upvote 0
You can use in combination: * SMS_RECEIVE intent to start service * SMS intercept lib to decide what with sms
Erel B4X founder Staff member Licensed User Longtime User Nov 5, 2012 #5 If I have read well, this is not possible with static receiver. Click to expand... You are correct. Your code will work though it will affect battery consumption. Also, what happens when the scheduled event raisebut the service is already running ? Is the code in service_start executed again ? (and how eventually to avoid it) ? Click to expand... Service_Start will be called again. Move all the code to Service_Create (except of StartServiceAt). Upvote 0
If I have read well, this is not possible with static receiver. Click to expand... You are correct. Your code will work though it will affect battery consumption. Also, what happens when the scheduled event raisebut the service is already running ? Is the code in service_start executed again ? (and how eventually to avoid it) ? Click to expand... Service_Start will be called again. Move all the code to Service_Create (except of StartServiceAt).