apk crashes in background when no internet connection

308 views Asked by At

I had developed a small application which is running fine while having internet connection. But crashes when lost internet connection. I had implemented

  1. Asynctask to fetch information from server and to display
  2. Service which continuously monitor for the new message and gives notification if it found a new one. It run for every minute.
  3. Declared min-sdk and target-sdk to 8 in the Manifest file.

Can anyone help me out of this ?? I am not getting an issue weather its an AsyncTask or API level.

1

There are 1 answers

4
Ced On

use try and catch to handle the exception like this:

try
{
    MyService.CallFunction();
}
catch(Exception ex)
{
    //Show an error Message
}