I'm using an IntentService to upload images to a server. My problem is that I don't know how/when to stop the service. When I call stopself() in onHandleIntent(Intent ..) all Intents which are waiting in the IntentService queue are removed. But I don't want to stop the service from an activity because I want to complete upload proccess even if my application is not running.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
An
IntentService
stops itself when it has no moreIntent
s (jobs) to process. It runsstopSelf(startId)
for eachIntent
(job). Have a look at theIntentService
source or theExtending the Service Class
from here http://developer.android.com/guide/topics/fundamentals/services.htmlIntentService
automatically stops itself whenonHandleIntent()
ends, if no more commands had been sent to it whileonHandleIntent()
was running. Hence, you do not manually stop anIntentService
yourself.Which is why you do not do that.
Then you let the
IntentService
stop itself.