views:

16

answers:

1

I am creating a appwidget which needs to update on a specific interval. I use AlarmManager for this.

I want to have the alarm run the onUpdate() method in the AppWidgetProvider.

    //Create the intent
    Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
    pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);              

    //Schedule the alarm        
    AlarmManager manager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
    manager.setRepeating(AlarmManager.RTC, startAlarmCal.getTime().getTime(), 1000 * 60, pendingIntent);

However, this intent causes all the widget's to update. I want to somehow only send this intent to my own appwidget. How would I do this?

A: 

Once again, it's all in the documentation:

updatePeriodMillis How often, in milliseconds, that this AppWidget wants to be updated

hpe
?? Are you answering another question? I need to use a alarm, since I need a specific updatepattern. Therefor I need to submit a broadcastintent, but this intent triggers all other widgets too.
Peterdk
AppWidgetProviderInfo's updatePeriodMillis will give you a specific update pattern, that's what it's there for! From the documentation:How often, in milliseconds, that *this* AppWidget wants to be updated.
hpe