0

I have a nanoHTTPD server running on my app in background, when i have like more than 30 http get requests to the server, from then server getting stopped, image loading fails.

is there a limit for number of http request in server, or is the android cannot handle those many request at once ? any help is appreciated.

yourkishore
  • 278
  • 8
  • 19

1 Answers1

2

How is your Android application structured? Is the server started by an activity as part of its normal lifecycle? If so, Android might simply be stopping & garbage collecting your activity once it's in the background.

To avoid that happening you will want to start an Android service and start/stop your NanoHttpd server in the service rather than the application.

There are no limits on the number of pages, or bytes, that the NanoHttpd server can serve. I'd point the finger at the Android lifecycle (without knowing any more that is).

Paul Hawke
  • 1,141
  • 10
  • 12
  • yes, its gargbage collecting problem, actually every android app is not allowed to use more than 16 mb of the memory, but when loading images we utilise more and i was instruceted to use smaller images so that it will reduce the garbage collection and it worked quite well – yourkishore Dec 13 '13 at 04:00