A broad Android mobile phone system

Source: Internet
Author: User

The following article focuses on what is the Android mobile phone system. Before getting familiar with the Android mobile phone system, let's get familiar with what is Android first? The so-called Android: Android includes a C/C ++ library set used by different components in the Android system.

As mentioned above, the configuration value in the AppWidgetProviderInfo class remains unchanged, because the updateTimeMillis value is in this class. For any Widget instance with AppWidgetProviderInfo, if this value is set, the Widget is updated based on its frequency.

There is no way to modify it, because this application should let the user configure the image refresh frequency in the Widget, so you must implement it automatically. The Android mobile system is the most commonly used update mechanism because it supports repeated notifications, which are simple PendingIntent objects that will be triggered.

You may want to create an Intent object with AppWidgetManager. ACTION_APPWIDGET_UPDATE and set additional values for the specific Widget identifier. Then you can call the setRepeating () method of AlarmManager and use the scheduling mechanism to update it repeatedly. Unfortunately, this approach does not work.

The Android mobile phone system repeatedly uses Intents to match behaviors and values. The "extra" values are not compared. In fact, the solution is very simple: first define a solution for your Widget, and then use it to define a unique Intent instance. The following code snippet shows how to achieve this goal:

In ImagesWidgetConfiguration Activity, you will find the previous code. The manifest file shows a block to process this specific scheme. You also need to stop duplicate alarms in the onDeleted () method of the AppWidgetProvider interface. Finally, when the phone restarts, the update scheduling must also be restarted.

A simple solution is provided in the onReceive () method of AppWidgetProvider. First, check the update behavior if it is an update. Make sure that it does not contain the scheme value. If it is not an update, the PendingIntent that schedules AlarmManager will not trigger this action. In this case, check whether each Widget identifier has a configuration option value.

If no, You will know that this update behavior is received before configuring the Widget. However, if the option value is valid, you know that you can schedule PendingIntent. In the onReceive () method, you can see the complete logical implementation. This scheme allows multiple widgets to be displayed at the same time, as shown in figure 2. Updates can also be performed at different frequencies. Each displayed image is randomly selected from the image set.

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.