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!
Okay, removing my app from the phone did the trick. Can't understand why uninstall fixed it. With anyone having the same problem, uninstall and reinstall your app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With