I'm having a problem with triggering of the onEnabled and onDisabled methods of the AppWidgetReciever. I have the actions specified, I also log every action in onRecieve method, but the only two actions I get are "APPWIDGET_UPDATE" and "APPWIDGET_DELETED". I have googled for this solution, but unfortunately found none. Here is my code:
Manifest part:
<receiver android:name=".ScheduleWidgetProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_ENABLED" />
<action android:name="android.appwidget.action.APPWIDGET_DISABLED" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/provider_xml" />
</receiver>
Provider_xml:
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="180dp"
android:minHeight="40dp"
android:updatePeriodMillis="60000"
android:initialLayout="@layout/widget_layout"
android:configure="org.zivkovic.schedule.ConfigurationActivity"
>
</appwidget-provider>
ScheduleWidgetProvider:
public class ScheduleWidgetProvider extends AppWidgetProvider {
{
Log.w("Schedule", "ScheduleWidgetProviderRequested");
}
@Override
public void onReceive(Context context, Intent intent) {
Log.w("Schedule", "On recieve " + intent.getAction());
super.onReceive(context, intent);
}
@Override
public void onEnabled(Context context) {
Log.w("Schedule", "OnEnabled called");
...
super.onEnabled(context);
}
@Override
public void onDisabled(Context context) {
Log.w("Schedule", "OnDisabled called");
...
super.onDisabled(context);
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
for (int i = 0; i < appWidgetIds.length; i++) {
....
}
super.onUpdate(context, appWidgetManager, appWidgetIds);
}
}
Any help is appreciated. Thanks!