1

friends.

I have to do next thing: We are writing special application for our customers. As we know, OS kills application sometimes (f.e low memory). So question is: Can i handle moment when OS killing it. I've read about onDestroy() event, but some people says, that event doesnt fired. Is it true?

Common question, can i handle OS killing application some way and restart it again.

I know, that is not good idea, but customers asks us about functionality like this.

Thank you for your help!

Pefeo Agenco
  • 75
  • 1
  • 5

1 Answers1

2

You can make it alarm driven using the AlarmManager class, check if your activity/app is up every few seconds (or minutes) and re-launch the activity if its been killed.

So the max time it can be down is the interval between two 'ticks' of the alarm

Dheeraj Bhaskar
  • 18,633
  • 9
  • 63
  • 66
  • I need two points of reputation for voting :) Thank you! Maybe you can give some example of AlarmManager and re-launch? – Pefeo Agenco Jul 24 '12 at 12:07