APPWIDGET_UPDATE 接收器的目的是什么

Jan*_*pas 4 android broadcastreceiver android-manifest android-appwidget

我正在开发一个由不再在公司工作的人编写的 Android 应用程序,并且不明白为 AppWidget 更新创建接收器的目的是什么。清单具有在应用程序启动时运行的主要活动。据我所知,appwidget 从未被使用过,它的代码与应用程序的其余部分是分开的。我不知道这是剩余的并且可以删除还是仍在使用。我发现的所有教程和示例都解释了如何实现这一点,但并不是真正解释为什么要这样做,尤其是在这种情况下。

清单文件中的代码:

<application
    android:debuggable="true"
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:theme="@style/ConnectTheme" >
    <activity
        android:name="com.globalcrossing.connect.ConferenceListView"
        android:label="@string/listTitle" >
        <intent-filter android:label="@string/app_name" >
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.globalcrossing.connect.Preferences"
        android:label="@string/set_preferences" >
    </activity>
    <!-- Broadcast Receiver that will process AppWidget updates -->
    <receiver
        android:name="com.globalcrossing.connect.ConferenceWidget"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
        </intent-filter>

        <meta-data
            android:name="android.appwidget.provider"
            android:resource="@xml/widget_provider" />
    </receiver>
... more activities I understand, deleted for brevity
 </application>
Run Code Online (Sandbox Code Playgroud)

ρяσ*_*я K 7

如文档中所示:

ACTION_APPWIDGET_UPDATE

当需要更新您的 AppWidget 时发送。

ACTION_APPWIDGET_UPDATE以下情况下的公平行动:

1.您的 AppWidget 的新实例从 AppWidget Chooser 添加到主屏幕(来自 AppWidget 提供商),

2.android:updatePeriodMillis当您使用属性在 AppWidget 元数据文件中提供的请求更新间隔已过时,以及

3.设备重启时