Updating the Android Manifest File

The Android manifest file needs to be updated to tell the system where to find the definition of the App Widget. An App Widget is a specialized form of a BroadcastReceiver control.

Therefore, a <receiver> definition must be placed within the AndroidManifest.xml file that defines what Intent objects will be received and a couple other pieces of data specific to the App Widget.

To accomplish this task, add the following <receiver> section to the application section of the AndroidManifest.xml file:

<receiver android:name="QuizWidgetProvider"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_info" /> </receiver>

This <receiver> segment of the Android manifest file defines an intent filter for App Widget updates. In addition, it ties the App Widget, and its definition file, to the overall application.

0 0

Post a comment