tags:

views:

236

answers:

1

Hi, I am doing an App which access the gprs .I am facing problem when the user starts another application who uses gprs also like google maps .It takes it own heap memory ,after doing some operation on Maps app it calls OnLowMemory of my service .and my ui is also killed in background. I am not getting any proper tutorial haw can i start my app when it is getting killed during onLowMemory ,or is there any other way to handle it .

Thanks in advance.

+2  A: 

There's no way you can relaunch your app. The Android OS takes care of killing low priority apps when it starts running out of memory. What you should do is try to save any state before your app gets killed. When the app is launched again, check if there's any state saved and restore your app to the last state.

You should also look as to why your phone is running low on memory, maybe your app is not cleaning up properly or using too many images, bitmaps, etc that use up a lot of memory?

Ricardo Villamil
thanks for the reply
Sam97305421562
I have stored the state of Intents in HashMap rather saving in bundle .Have you any tutorial related to state saving because I have made my main class as single instance
Sam97305421562
Well, saving in bundle allows Android to do a lot for of the dirty work for you, like autopassing it to onCreate when your app is relaunched. Check this out: http://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state
Ricardo Villamil