I am getting a DownloadManager.ACTION_DOWNLOAD_COMPLETE broadcast upon getting I am required to extract the zip file and fill the the data base I have written the code to do my work .But I have to start the Thread here to handle the file extraction and insertion to database.
I know that a thread cannot be started inside broadcast receiver . If any body has encounter the problem please suggest the solution .. as my work will take time in insertion so i dont want to wait and stick with it.
I am getting exception while running thread inside broadcast receiver and
Writing this code also not working inside broadcast receiver
BroadcastReceiver onComplete = new BroadcastReceiver() {
public void onReceive(Context ctxt, Intent intent) {
/*
* check status message whether the last queue is successful and
* completed and then stop self
*/
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(intent.getAction())) {
Intent mIntent = new Intent(downloadmanager1.this, DBService.class);
mIntent.putExtra("messenger", new Messenger(mHandler));
mIntent.putExtra("enqueue", enqueue);
ctxt.startService(mIntent);
// ctxt.startService(mIntent);
}
}
Note - no exception or error is through and neither any Intentservice is started in DDMS while debugging
};