Reputation: 6449
I have 1 android app project and 1 widget project, they all work fine. Now, i want to include widget project to android app project in order to when user install application, the widget will be installed too. I did like below but it did not work. Any helps? Thanks you!
In manifest file:
<application>
............ (this is of android app project. below is of widget).......
<receiver android:name=".widget.PlayerWidgetActivity" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/playerwidgetprovider" />
</receiver>
<service android:name=".widget.PlayerWidgetActivity$UpdateService" />
<service android:name=".widget.PlayerWidgetActivity$ServiceBindUnbindService" />
</application>
EDIT
: My application is quite big (.APK ~ 10MB), of course it has many activity, many services, many broadcast receivers, ..... so it takes times to build.
I create a new very small application with just an activity and put the code for widget like i put on the big app above. It works! OMG! Why it worked on that small app but not my big app :(
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".activity.ApplicationWithWidgetActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".widget.PlayerWidgetActivity"
android:icon="@drawable/ic_launcher"
android:label="@string/appwidget_name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/playerwidgetprovider" />
</receiver>
<service android:name=".widget.PlayerWidgetActivity$UpdateService" />
<service android:name=".widget.PlayerWidgetActivity$ServiceBindUnbindService" />
</application>
Upvotes: 4
Views: 4798
Reputation: 6972
I've had same problem!
The solution is - INSTALLING APPLICATION INTO PHONE.
Just move application to phone and you will see your widget.
Hope it helps you!
Info from here: http://www.hrupin.com/2012/07/how-to-fix-android-homescreen-widget-installation-widget-as-part-of-android-application
Upvotes: 2