My app updates within a service, and first does this to get the widget's id:
AppWidgetManager widgetManager = AppWidgetManager.getInstance(this);
int[] widgetIds = widgetManager.getAppWidgetIds(new ComponentName(this, WidgetReceiver.class));
Sometimes, this method will return an empty array, even though the widget is still on the home screen. I searched around and couldn't find anything about this. The issue is that it doesn't always happen, only sometimes (though when it happens once it seems like it won't be successful on subsequent update attempts).
Has anyone ever run into this, and better yet found a solution? Much appreciated.