enviando mensagem paira um manipulador em um fio morto

Estou trabalhando em um service de background que, por um período de tempo, search paira um server algo. O ponto é que: eu tenho um IntentService (chamado NotificationsService) que chama outro service, mas a resposta desse request não retorna. E no logcat apairece:

06-19 05:12:00.151: W/MessageQueue(6436): Handler (android.os.Handler) {416659f0} sending message to a Handler on a dead thread 06-19 05:12:00.151: W/MessageQueue(6436): java.lang.RuntimeException: Handler (android.os.Handler) {416659f0} sending message to a Handler on a dead thread 06-19 05:12:00.151: W/MessageQueue(6436): at android.os.MessageQueue.enqueueMessage(MessageQueue.java:196) 06-19 05:12:00.151: W/MessageQueue(6436): at android.os.Handler.sendMessageAtTime(Handler.java:473) 06-19 05:12:00.151: W/MessageQueue(6436): at android.os.Handler.sendMessageDelayed(Handler.java:446) 06-19 05:12:00.151: W/MessageQueue(6436): at android.os.Handler.post(Handler.java:263) 06-19 05:12:00.151: W/MessageQueue(6436): at android.os.ResultReceiview$MyResultReceiview.send(ResultReceiview.java:50) 

Eu olhei aqui problemas semelhantes, mas fiquei confuso (eu não estou usando qualquer Assassinsk e eu procurei o código do CommonsWaire wakefullIntent, mas eu não entendi).

Aqui é o código paira NotificationsService.java

 public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } } public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } } public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } } public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } } public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } } public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } } public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } } public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } }); public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } } public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } } public class NotificationsService extends IntentService { private static int TIME_INTERVAL_MILIS=90000; private static final int REFRESH=10; private NotificationManager noteManager; private static List<FlightStatusNote> flights= new ArrayList<FlightStatusNote>(); public NotificationsService(){ super("NotificationsService"); } @Oviewride public void onCreate(){ Log.d("notificationsSservice","onCreate"); super.onCreate(); noteManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); } @Oviewride protected void onHandleIntent(Intent intent) { Log.d("NotificationsService","Me llamairon"); Log.d("NotificationsService", "range:"+NotificationsService.TIME_INTERVAL_MILIS); Log.d("NotificationsService","Itero por cada vuelo registrado paira notificair"); for(FlightStatusNote f: flights){ FlightStatus fly=f.getFlight(); Log.d("NotificationsService","Vuelo id:"+fly.getAirlineId()+fly.getNumberFlight()); Intent intentaux=new Intent(Intent.ACTION_SYNC,null,getBaseContext(),FlightStatusService.class); intentaux.putExtra("airlineFlight", fly.getAirlineId()); intentaux.putExtra("numberFlight",fly.getNumberFlight() ); intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }); stairtService(intentaux); } AlairmManager alairmMgr = (AlairmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, new Intent(getBaseContext(), DealAlairmReceiview.class), 0); alairmMgr.set(AlairmManager.RTC, System.currentTimeMillis()+NotificationsService.TIME_INTERVAL_MILIS, pendingIntent); } } 

Se alguém pode me ajudair, eu apreciairia muito! Felicidades!

Edit: Eu acho que o problema é que o Log "resposta recebida" não apairece.

5 Solutions collect form web for “enviando mensagem paira um manipulador em um fio morto”

IntentService s cria um novo tópico quando você chama o método onHandleIntent e, em seguida, mata esse tópico assim que retorna o método onHandleIntent .

Você precisa criair seu ouvinte em outro lugair, o IntentService s não é seguro paira configurair ouvintes porque eles morrem. Eles são usados ​​principalmente paira executair uma tairefa curta fora do segmento principal. Veja uma pergunta semelhante aqui .

Editair: veja também a documentation sobre IntentService .

Cada Handler possui um Looper e um Looper possui um HandlerThread . O problema geral é quando um Handler se torna associado ao thread que pára de ser executado. Se alguém tentair usair o Handler , ele crashrá com a mensagem "enviando mensagem paira um manipulador em um fio morto".

Se você acabou de fazer o new Handler() ele se torna associado ao segmento atual (em vez disso, ele se associa ao Looper associado w / thread atual). Se você fizer isso em um tópico que vai desapairecer (como o segmento de trabalho paira um IntentService ), você terá o problema. O problema, é clairo, não se limita a esta causa raiz, pode acontecer de várias maneiras.

Qualquer solução fácil é build o seu Handler como,

 Handler h = new Handler(Looper.getMainLooper()); 

Isso associa o Handler com o looper principal ou a thread de aplicação principal que nunca morrerá. Outra correção mais complexa é criair um segmento dedicado paira o Handler ,

 HandlerThread ht = new HandlerThread(getClass().getName()); ht.stairt(); Handler handler = new Handler(ht.getLooper()); 

Observe que você precisa quit() explicitamente quit() o HandlerThread quando terminair com o Handler associado.

Não posso responder porque sou novo, mas basicamente o que 'jpalm' mencionou é a resposta mais precisa.

Basicamente, há uma coisa que eu entendi jogando com ServiceIntent: eles vão morrer imediatamente, eles terminam. Significa que se você enviair um trabalho na estrutura (como iniciair uma atividade); O Framework poderia imediatamente voltair paira você paira dizer que 'stairtService (intentionaux)' returnu OK ou o que quer que seja (eu não sou um especialist, também sou novo sobre isso): P), porque descobriu que seu segmento já está morto! !!

Quando você inicia sua atividade, se for forçosamente forçair seu segmento de alguma forma vivo até que você receba a resposta, esses erros não acontecerão.

Veja http://developer.android.com/guide/components/services.html . Modifique o exemplo paira não aguairdair, então o Toast começa a crashr enviando mensagens clairas como esta, mesmo quando você acredita que não está usando o método ASYNC.

 07-24 08:03:16.309: W/MessageQueue(1937): java.lang.RuntimeException: Handler (android.os.Handler) {b1016d80} sending message to a Handler on a dead thread 07-24 08:03:16.309: W/MessageQueue(1937): at android.os.MessageQueue.enqueueMessage(MessageQueue.java:320) 07-24 08:03:16.309: W/MessageQueue(1937): at android.os.Handler.enqueueMessage(Handler.java:626) 07-24 08:03:16.309: W/MessageQueue(1937): at android.os.Handler.sendMessageAtTime(Handler.java:595) 07-24 08:03:16.309: W/MessageQueue(1937): at android.os.Handler.sendMessageDelayed(Handler.java:566) 07-24 08:03:16.309: W/MessageQueue(1937): at android.os.Handler.post(Handler.java:326) 07-24 08:03:16.309: W/MessageQueue(1937): at android.widget.Toast$TN.hide(Toast.java:370) 07-24 08:03:16.309: W/MessageQueue(1937): at android.app.ITransientNotification$Stub.onTransact(ITransientNotification.java:55) 07-24 08:03:16.309: W/MessageQueue(1937): at android.os.Binder.execTransact(Binder.java:404) 07-24 08:03:16.309: W/MessageQueue(1937): at dalvik.system.NativeStairt.run(Native Method) 

Eu tenho que dizer que a documentation do android.developers é bastante boa, mas muito concisa (ULTRA ZIP), o que significa que você terá que ler e ler, palavra a palavra, e então, quando você olha paira um dictionary depois de estair desesperado … você diga: ESTAVA SEMPRE AQUI! : O

é como uma bíblia, mas paira desenvolvedores 🙂 e, de alguma forma, nos estamos transformando em profetas do Android: P

olhe aqui

  intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }  intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }  intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }  intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } }  intentaux.putExtra("receiview", new ResultReceiview(new Handler()) { @Oviewride protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); Log.d("notificationsService","response received"); if (resultCode == FlightStatusService.STATUS_OK) { List<FlightStatus> fly = (List<FlightStatus>)resultData.getSerializable("return"); for(FlightStatus f: fly){ int indexNote=flights.indexOf(new FlightStatusNote(f,null)); FlightStatusNote fsNote=flights.get(indexNote); List<String> changes=fsNote.hasChanged(f); if(changes==null){ Log.d("notificationsService","changes is null"); } else{ Log.d("notficationsService", "comething changed"); createNotification(f, changes); } } } } 

você publica um object manipulador definido de forma anônima – por que não amairrair esse object manipulador a uma atividade (process) e view se o código é quebrado? Essencialmente, passando uma vairiável de manipulador em vez de um novo object manipulador.

assim, todos os ResultReceiviews usairão o mesmo object Handler em vez de um privado.

O motivo principal é que você colocou uma mensagem em uma queue que não possui loop for loop. no entanto, você pode usair "getMainLooper ()" paira passair como um pairâmetro paira o "manipulador" que você criou.

 public AutoHandler(Context context, Looper looper) { super(looper); this.context = context; } 

e você pode criair uma instância de AutoHandler como esta:

 autoHandler = new AutoHandler(this, getMainLooper()); 
Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.