Changes

Jump to: navigation, search

Implementing Local Bound Services in Android Studio

31 bytes removed, 18:55, 19 January 2015
no edit summary
Launch Android Studio and follow the usual steps to create a new project, entering LocalBound into the Application name field and ebookfrenzy.com as the Company Domain setting before clicking on the Next button.
On the form factors screen, enable the Phone and Tablet option and set the minimum SDK setting to API 8: Android 2.2 (Froyo). Continue to proceed through the screens, requesting the creation of a blank activity named LocalBoundActivity with a corresponding layout named activity_local_boundthe remaining fields set to the default values.
Once the project has been created, the next step is to add a new class to act as the bound service.
== Adding a Bound Service to the Project ==
To add a new class to the project, right-click on the package name (located under LocalBound -> app -> src -> main -> java -> com.ebookfrenzy.localbound) within the Project tool window and select the New -> Service -> Service menu option. Specify BoundService as the class name and make sure that both the Exported and Enabled options are selected before clicking on Finish to create the class. By default Android Studio will load the BoundService.java file into the editor where it will read as follows:
<pre>
[[Image:android_studio_bound_service_uiandroid_studio_bound_service_ui2.png|The user interface for an Android Studio local bound service example]]
Figure 38-1

Navigation menu