Get the currently active widget

1k views Asked by At

I have got all the widget app list.My problem is that I am not able to know that which widget is currently active in the phone. I am getting the list of widget apps by this code,

AppWidgetManager manager1=AppWidgetManager.getInstance(ctx);
        List<AppWidgetProviderInfo>infoList=manager1.getInstalledProviders();
        for(AppWidgetProviderInfo info:infoList)
        {
           String component = ""+info.provider;
           Log.i("Widget", ""+component);

        }

ctx is the object of Context.

I am able to get the name of currently active package name of Applications but in case of Widgets, I am not.

2

There are 2 answers

0
Tushar On BEST ANSWER

I have not tried this but u may Try using getRunningServices As These widgets communicates with their apps with internal broadcast receivers so u can not intercept that

0
mob_web_dev On
ActivityManager actvityManager = (ActivityManager)
this.getSystemService( ACTIVITY_SERVICE );
List<RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses();

Example Here : http://www.dreamincode.net/forums/topic/138412-android-20-list-of-running-applications/