I'd like to get a running activity of my application and call one of its method (I'm inside of a service). I have found that I need something like this, but i can't resolve my problem. Is it possible?
ActivityManager am = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> procInfos = am.getRunningAppProcesses();
for (int j = 0; j < procInfos.size(); j++) {
if (procInfos.get(j).processName.equals("com.android.pm")) {
...
}
}