Creating the service
The heart of the Android portion of the project is our REST endpoints. We would like these endpoints to be available whenever the phone is on, so we can't use an Activity to host them. What we want is a Service. The Android documentation defines a Service as an application component that can perform long-running operations in the background, and it does not provide a user interface. There are three types of Services--scheduled (which runs on a schedule), started (which can be started explicitly by another application component), and bound (which is bound to an application component via the bindService() call, and runs until all the bound components are destroyed). Since we want this to be available all the time, we want ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access