Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 3
    Wow, this was incredibly thorough. Nice answer! Commented Jan 7, 2016 at 3:44
  • I have gone through the tutorials, they are great! But is the problem that I haven't @overide the onStartCommand or the onHandleIntent? Commented Jan 7, 2016 at 4:09
  • You told on the question that you did override the onStartCommand, and you shouldn't do that on IntentService. Use onHandleIntent instead, it's automatically called. Commented Jan 7, 2016 at 4:11
  • no, I didn't override both of them. So the solution is that I put my code in the onHandleIntent() function, override it, and just leave return Service.START_STICKY; in the onStartCommand() function and not override it. Is that correct? Commented Jan 7, 2016 at 6:50
  • 1
    Actually if you're using IntentService you shouldn't even bother to write a onStartCommand method at all. Put your logic inside the onHandleIntent instead. Commented Jan 7, 2016 at 20:11