Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid How to magare Intentservice queue?
    primarykey
    data
    text
    <p>I have an activity with a download button. When i click on it a service is started. The service create a notification and post it in the notification bar. If i show the notification details i can see a progrees bar showing th download status.</p> <p>Cause i didn't know that a service runs on the main thread, someone suggested me to use an intentservice that create a worker thread by itself. SO everything is fine and my gui doesn't freeze during the download.</p> <p>I have one problem. To use intentservice i had to implement the download code and the notification part inside the method onHandleIntent. Now i found out that an intentservice has a kind of queue that manage intents once per time . SO if i click the download button from the activity twice it crate a new notification, starts the download and then when it has finished it enter onHandleIntent again,it creates the second notification and starts the second download. For me it's fine to download files back to back and not together, but at least i would like that if i press twice the download button the serivce upload the notifications saying that there are 2 downloads waiting. I'm not able to do that cause the intent service do the code once and the once again..........Is there a way to fix it?</p> <p>Is there a way to handle the queue manually saying something like....if you get another intent do this........update notification.......and then continue with the dirst download....</p> <p>ANother question, can a intent service modify the gui considering that is working on another thread or i have to use an handler and send a message back to the activity?</p> <p>And last, whwere is the thread created, justa after the onCreated method or inside the onHandleIntent???</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