In my app, I want to list ALL home screen widgets. My code is like this:
mWidgetInfoList = AppWidgetManager.getInstance(getActivity()).getInstalledProviders();
int count = 0;
for (AppWidgetProviderInfo one: mWidgetInfoList) {
Log.d(TAG, "onViewCreated, widget " + count + ": " + one.label + ", " + one.toString());
count++;
}
It work almost ok. The question is: getInstalledProviders()
just returns a incomplete list. For example, in my Samsung Note3 (Android 5.0), two of the widgets not returned by getInstalledProviders()
are "S Planner", which are two different size calendar widgets, as shown by Samsung TouchWiz.
But there is also another widget not shown by TouchWiz, which is "Calendar". Log shows it appears to be actually S Planner itself:
05-04 16:23:12.977 30699-30699/com.lxj.simplehome D/WidgetListFragment﹕ onViewCreated, widget 16: Calendar, AppWidgetProviderInfo(provider=ComponentInfo{com.sec.android.widgetapp.SPlannerAppWidget/com.sec.android.widgetapp.SPlannerAppWidget.EasyWidget.EasyCalendarAppWidgetProvider})
So, how to get full list (with different sizes)?