Im building an app in which i need to know the current running activity from a service. I was able to achieve this with the below code found in stack overflow:
ActivityManager am = (ActivityManager) this .getSystemService(ACTIVITY_SERVICE);
List<RunningTaskInfo> taskInfo = am.getRunningTasks(1);
ComponentName componentInfo = taskInfo.get(0).topActivity;
Toast.makeText(this, "CURRENT Activity ::" + taskInfo.get(0).topActivity.getClassName(), Toast.LENGTH_LONG);
Now i would want to know if any extras are passed to this current running activity intent or not. Also if the extras were passed i would want to know the values assuming that i have the key for the values?