1

My app stores large amount of user data in local database, like use name password, user file, images etc by IntentService which calls several web services, every thing is working well. My problem is if new user logs in, while the IntentService is still running I am unable to delete the old user data the log says Data Base locked. How to stop IntentService and delete database to replace with new user data.

EDIT

I followed this for insertion.

Kishore
  • 2,051
  • 5
  • 26
  • 45

1 Answers1

0

when you want to change the data.. broadcast an intent..like this

 Intent intent=new Intent(getApplicationContext());
intent.setAction("com.toxy.Edit");
intent.putExtra("work","Editing");
sendBroadcast(intent);

in the onrecieve of the receiver

 @Override
  public void onReceive(Context context, Intent arg1) {

            String w = arg1.getExtras().getString("work");

       if(w=="Editing")
       {
          //pause the intent service here.. 
        }

refer this question to pause.. How to stop an IntentService? else{

        //resume the intent service...
       }

     }
Community
  • 1
  • 1
5hssba
  • 8,079
  • 2
  • 33
  • 35