At first i thought that it would work as is, due to extending BroadcastReciever
, however it does not.
So onEnabled
I have registered it for the desired intent ACTION_TIME_TICK
.
However, it is never received.
How can I correctly capture the broadcast, so that i can update the widget's clock, as well as refresh some values on my widget. Doing so on the minute mark is the ideal time.
public class Widget extends AppWidgetProvider {
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
Log.v("WIDGET", "Recieved: " + intent.getAction());
}
@Override
public void onDisabled(Context context) {
super.onDisabled(context);
//Turn off auto update
context.unregisterReceiver(this);
}
@Override
public void onEnabled(Context context) {
super.onEnabled(context);
context.registerReceiver(this, new IntentFilter(Intent.ACTION_TIME_TICK));
// Start auto update on Enable (widget exists)
}
}