سؤال

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

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

نصائح أخرى

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/

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top