Search code examples
androidbroadcastreceiverandroid-manifestandroid-appwidget

What is the purpose of a receiver for APPWIDGET_UPDATE


I'm working on an Android app written by someone no longer with the company, and not understanding what the purpose is of creating a receiver for AppWidget updates. The manifest has the main activity which runs when the app is launched. As far as I can tell, the appwidget is never used and its code is separate from the rest of the app. I can't tell if this is a left-over and can be removed or if it is still in use. All of the tutorials and examples I find explain how to implement this, but not really why one would, especially in this case.

Code from the manifest file:

<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>

Solution

  • If the application has a corresponding home screen widget, which can be found under the widgets section in the all programs list, then you will need APPWIDGET_UPDATE. Otherwise it will be unnecessary noise to your application with no purpose.