Simple learning experience: NetEase Cloud Classroom Android Development fourth chapter service, broadcast and cool features

Source: Internet
Author: User

1. Service

(1) Meaning: Service is an application component that runs in the background for a long time, and the threads are the main thread.

(2) How to use: StartService can perform onstartcommand operations, Bindservice can return the instance object of the service to the activity, thus enabling the use of service in the activity. Instead, the service object was created with the new method without an error, but the service's method could not be successfully invoked.

(3) Note: In Onstartcommand, the teacher suggested that we change the return value to Start_not_sticky, look at the API documentation, you can know that the value of the approximate meaning is that after the service was killed, if not passed in the new intent, it will not be re-created.

2, Broadcastreceiver

(1) Registration method: Register as a static registration in the Androidmanifest.xml, dynamic registration in. Java, dynamic registration also requires dynamic logoff.

(2) Other: In the activity, the service can set the internal broadcast receiver.

3. Widgets

(1) Regarding widgets, I can only understand that it is a desktop widget that can run directly on the desktop. Others are not understood, including the creation of a teacher's presentation.

Simple learning experience: NetEase Cloud Classroom Android Development fourth chapter service, broadcast and cool features

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.