"Sail Plan 035" 2015 sail plan Android Apidemo Devil step app->service->local Service Controller

Source: Internet
Author: User

The Local service Controller uses LocalService as a "Started" service, which is much simpler than the "Bound" service, Localserviceactivities.controller started the local Service, it basically doesn't matter localservice.

StartService (new Intent (Controller.  this, LocalService. class));

LocalService can choose to stop itself, this example is by calling StopService to stop the service, if you start the service in this example, there is no stopservice, the service will run in the background, Even if you exit Appdemo or launch another app (a triangle will always appear above the screen). For the local service binding, the situation is different, after binding service, even if you do not click the "Unbind Service" button, press "Back" key, the binding activity exits, The Android system will automatically disconnect from the LocalService. Notification at the top of the screen will disappear automatically.

In addition, this example LocalService is called the "Local" Service, except for the call interface between the IBinder objects mentioned above, allowing only the components of the same application to be called outside. LocalService is defined in Androidmanifest.xml as:

<service android:name= ". App. LocalService "/>

Does not contain any intent-filter, which means that the service class can only be specified through explicit, which generally cannot be accessed directly by different applications.

"Sail Plan 035" 2015 sail plan Android Apidemo Devil step app->service->local Service Controller

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.