Note that there are some explanatory texts on larger screens.

plurals
  1. POAsyncTask Issue related to Notifications and IntentService
    primarykey
    data
    text
    <p>I have a pretty weird problem. I'm setting a notification in my Service in order to launch an Activity. When the Activity launches, an <code>AsyncTask</code> is started. This is how I set up the notification:</p> <pre><code>CharSequence tickerText = getString(R.string.notificationTextUpdates); CharSequence contentText = getString(R.string.app_name); Notification notification = new Notification(icon, tickerText, System.currentTimeMillis()); Intent notificationIntent = new Intent( getApplicationContext(), MyActivity.class); PendingIntent contentIntent = PendingIntent .getActivity(getBaseContext(), 0, notificationIntent, 0); notification.setLatestEventInfo(getApplicationContext(), tickerText, contentText, contentIntent); notifManager.notify(0, notification); </code></pre> <p>If the application is running, everything works, but if it wasn't running before, the AsyncTask's <code>onPostExecute</code> method doesn't get fired. Instead I get the following exception:</p> <blockquote> <p>09-30 16:07:52.500: WARN/MessageQueue(27729): java.lang.RuntimeException: Handler{4057ec78} sending message to a Handler on a dead thread 09-30 16:07:52.500: WARN/MessageQueue(27729): at android.os.MessageQueue.enqueueMessage(MessageQueue.java:196) 09-30 16:07:52.500: WARN/MessageQueue(27729): at android.os.Handler.sendMessageAtTime(Handler.java:457) 09-30 16:07:52.500: WARN/MessageQueue(27729): at android.os.Handler.sendMessageDelayed(Handler.java:430) 09-30 16:07:52.500: WARN/MessageQueue(27729): at android.os.Handler.sendMessage(Handler.java:367) 09-30 16:07:52.500: WARN/MessageQueue(27729): at android.os.Message.sendToTarget(Message.java:350) 09-30 16:07:52.500: WARN/MessageQueue(27729): at android.os.AsyncTask$3.done(AsyncTask.java:214) 09-30 16:07:52.500: WARN/MessageQueue(27729): at java.util.concurrent.FutureTask$Sync.innerSet(FutureTask.java:253) 09-30 16:07:52.500: WARN/MessageQueue(27729): at java.util.concurrent.FutureTask.set(FutureTask.java:113) 09-30 16:07:52.500: WARN/MessageQueue(27729): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:311) 09-30 16:07:52.500: WARN/MessageQueue(27729): at java.util.concurrent.FutureTask.run(FutureTask.java:138) 09-30 16:07:52.500: WARN/MessageQueue(27729): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) 09-30 16:07:52.500: WARN/MessageQueue(27729): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)</p> </blockquote> <p>Strangely enough, this <strong>doesn't</strong> happen, when I set up the same notification inside another Activity, so everything works as intended.</p> <p>I'm quiet confused. My Activity runs in SingleTask mode, I also tried SingleTop mode, which basicly didn't change anything.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload