I have a widget that has network access.
Updating widgets in power saving mode results in a timeout exception.
It turns out that handling the battery optimization exception will resolve it.
But some apps have seen network access in widgets without any battery optimization exceptions.
How are they possible?
Here is my subclass of AppWidgetProvider.
public class WidgetProvider4x2 extends AppWidgetProvider {
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
for (int appWidgetId : appWidgetIds) {
requestApi();
}
}
private void requrestApi() {
// timeout occurs
}
}