Search code examples
androidandroid-appwidget

How to obtain the installed widget list?


I'm trying to read the available home screen widgets list on Android. I can populate a grid using the available applications list using

Intent myIntent = new Intent(Intent.ACTION_MAIN, null);
myIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> appsInfo = MyActivity.getPackageManager().queryIntentActivities(myIntent, 0);

and than iterating through each ResolveInfo.
How can I do the same with available Home screen widgets? I'd like to populate a grid with the same list that appears keep touching the screen and choosing 'widget' from the appearing popup.


Solution

  • Call getInstalledProviders() on an AppWidgetManager.