Loading Process of desktop widgets during Android startup

Source: Internet
Author: User

Androidwidgetservice. Java is the core class of the widget framework. It manages all widgets.

After the system server is started, the process will manage other services)

Creates an appwidgetservice instance and calls the systemready method of appwidgetservice.

In this method, the initialization and loading of widgets are completed, mainly through three tasks.

1. traverse all installation packages and find the qualified intent referers (Action = action_appwidget_update) and <meta_data Android: Name = "android. appwidget. provider"/>.

Parse related information and save it to local variables.

2. Read text data/system/appwidgets. xml. All the widgets installed on the desktop are saved in this file and the results are saved locally.

3. register to receive three messages: action_boot_completed (this message will be broadcast when the system starts to launcher), action_package_added (this message will be broadcast when the new APK is installed to the System), action_package_remover (this message is broadcasted when an application is deleted)

After the system starts to the desktop, appwidgetservice receives the action_boot_completed message, which checks local data. If a widget is installed with launcher, it sends action_apppwidget_enable and action_appwidget_update messages to start the widget.

In addition, if the updateperiodmills attribute is set for a widget, The action_appwidget_update message is reported at intervals to update the widget periodically.

Related Article

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.