4

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.

Custadian
  • 845
  • 1
  • 11
  • 37
  • Here is the solution for your question http://stackoverflow.com/questions/8836724/check-widget-is-placed-on-android-screen/8837570#8837570 – TechArcSri Jan 04 '14 at 06:51
  • Actually, I am trying to get the package name of widget(another application) from my own application.@Sridhar You are giving me the solution to do activeCheck in my application only.. – Custadian Jan 04 '14 at 06:54

2 Answers2

2
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/

mob_web_dev
  • 2,342
  • 1
  • 20
  • 42
1

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

Tushar
  • 1,122
  • 1
  • 13
  • 28