How can I see if my service (which is scheduled with StartServiceAt) is in the queue and ready to run?
In my service I use a StartServiceAt, run my code, then a stopservice. I do not want the service kept alive by keeping it in the foreground. So even if I did not do a stopservice, android could destroy my service if resources get low. Which is what is happening to one of my users. Unfortunately, he has a task killer and it killed my app which also removed the service's next call from the queue. I don't care that it killed my app, but on his particular device it killed the entire app and next service queue.
So I thought it would be nice, the next time the app is started, to check to see if the Service is scheduled (not check if it is running, as it probably will not be). If it is not, give them a friendly reminder, "please make sure to exclude this app from your task killer if you want it to automatically run every hour" message.
I can easily re-schedule the service when the app starts, but I would really like to check, explain to the user what is going on, and then reschedule. I can't seem to figure out how to determine if it is in the queue. I actually have a work-around with flags and checking to see if the service ran, and more flags in a text file . . . but there has to be a better way!
Thanks,
Craig
In my service I use a StartServiceAt, run my code, then a stopservice. I do not want the service kept alive by keeping it in the foreground. So even if I did not do a stopservice, android could destroy my service if resources get low. Which is what is happening to one of my users. Unfortunately, he has a task killer and it killed my app which also removed the service's next call from the queue. I don't care that it killed my app, but on his particular device it killed the entire app and next service queue.
So I thought it would be nice, the next time the app is started, to check to see if the Service is scheduled (not check if it is running, as it probably will not be). If it is not, give them a friendly reminder, "please make sure to exclude this app from your task killer if you want it to automatically run every hour" message.
I can easily re-schedule the service when the app starts, but I would really like to check, explain to the user what is going on, and then reschedule. I can't seem to figure out how to determine if it is in the queue. I actually have a work-around with flags and checking to see if the service ran, and more flags in a text file . . . but there has to be a better way!
Thanks,
Craig