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
Get the currently active widget
-
24-09-2022 - |
Domanda
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.
Soluzione 2
Altri suggerimenti
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/
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow