I know how to retrieve information about the foreground app:
public ActivityManager.RunningTaskInfo getForegroundTask()
{
ActivityManager am = (ActivityManager) mContext.getSystemService( Activity.ACTIVITY_SERVICE );
return am.getRunningTasks(1).get(0);
}
public String getForegroundTaskPackageName()
{
return getForegroundTask().topActivity.getPackageName();
}
My question is, how can I know for sure that the foreground app is the launcher? I can't rely on the package name as it could be anything, like "com.android.launcher" or "com.htc.launcher".
Thanks