I had to include this code in my service class. Basically, it sends the update to every single widget. It’s been over a year now; the button on my widget always works and the widget updates without any problem.
int[] arrayOfInt = AppWidgetManager.getInstance(getBaseContext())
.getAppWidgetIds(new ComponentName(this, mywidget.class));
AppWidgetManager localAppWidgetManager = AppWidgetManager.getInstance(this);
new WebView().onUpdate(getBaseContext(), localAppWidgetManager, arrayOfInt);
int i = arrayOfInt.length;
for (int j = 0;; j++) {
if (j >= i)
return;
int k = arrayOfInt[j];
RemoteViews localRemoteViews = new RemoteViews(getBaseContext()
.getPackageName(), R.layout.xx);
localRemoteViews.setTextViewText(R.id.tv, tv_text);
localRemoteViews.setOnClickPendingIntent(
R.id.Button01,
PendingIntent.getActivity(getBaseContext(), 0, new Intent(
getBaseContext(), LicenseCheck.class), 1));
localAppWidgetManager.updateAppWidget(k, localRemoteViews);
}