Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Caroline Wang
Caroline Wang
314 Points

What's the difference between start service and bind service?

From the video and previous lessons, the service can be started anyway without binding it. And here it's only binding it without starting it. So what's difference and which one is preferred?

1 Answer

Ben Deitch
STAFF
Ben Deitch
Treehouse Teacher

In Android, a Service can either be started or bound (or both). A started Service is for when you need the Service to do some work, like download a podcast. And when the work is done the Service will be stopped.

A bound Service is for when you need the Service to act like an AP. Most Android system Services work like this. So for something like latitude/longitude we connect to the location Service, and it acts as sort of an internal API giving us access to the device's location data.