以下の内容はhttps://android-java.hatenablog.jp/entry/2016/06/23/192620より取得しました。


ウィジェットが複数の場合のマニフェストファイルについて

複数ウィジェットのマニフェストファイル

通常アプリのマニフェストファイルと、ウィジェットのマニフェストファイルは中身が少し違っていますが、これは、Android Studioのプロジェクト作成機能を利用すれば自動で生成されます。

<ウィジェットのマニフェストファイル基本>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sample.test">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<receiver android:name=".sample_widget"> //ウィジェットの場合レシーバーの設定が必要になる
<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>

</application>
</manifest>

 

複数のウィジェットをもつアプリの場合は、ウィジェットの数だけレシーバーを追加します。※マニフェストファイルは以下のようになります。

<複数ウィジェットのマニフェストファイル>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sample.test">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

//ウィジェット①
<receiver android:name=".sample_widget1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/mb_info1" />
</receiver>

//ウィジェット②
<receiver android:name=".sample_widget2">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/mb_info2" />
</receiver>

</application>
</manifest>

 

END




以上の内容はhttps://android-java.hatenablog.jp/entry/2016/06/23/192620より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14