Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hello I'm looking for a bit of advice in which way is the best to proceed creating my applications 'gameloop' - It doesn't want to be a game loop in the truest sense since I'm not really rendering any graphics just displaying some animated gifs.

My goal is to have a task that runs every 30 minutes that decrements pet variables

Example Method 
passTime { <pets health> = <pets health> - 1; <pets hunger> = <pets hunger> -1; <pets exp> = <pets exp> + 5; } et

c. I was wondering the best way to go about this? AsyncTask will be of no use since this ideally wants to be running even when the app isn't.

I would rather use an IntentService subclass rather than a Service subclass but I can't seem to get the IntentService to run through a pendingIntent via the AlarmManager.

So I'm asking advice on the best way to proceed from the ground up with this. Thank you!

share|improve this question
Could you just record the time of the last 'feed time' or 'pass time' and on app-open check then? Or is this not okay, since the pet cannot have damage done when the phone is off? – Vaughan Hilts Feb 23 '13 at 0:39
I could do this but for example if I had it running through a service I could notify the user when certain conditions are met if (pet.hunger <10) { toast,notification etc..} the idea is for the app to have its own 'digital' timeline (or loop) (starting from when user selects pet) – Pheonix2105 Feb 23 '13 at 0:50

If you are looking for your 'tick' method to be called every X minutes, you could look at using a timerTask. This will allow for your method to be called at a specific time.

You can find some more information and an example here:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.