public static boolean isApplicationInFront(Context mContext)
{
ActivityManager am= (ActivityManager)
mContext.getSystemService(Context.ACTIVITY_SERVICE);
ArrayList rti = new ArrayList();
rti=(ArrayList)am.getRunningTasks(2);
String currenact = rti.get(0).topActivity.getPackageName().toString();
if(currenact.equals(mContext.getPackageName().toString()))
return true;
return false;
}
{
ActivityManager am= (ActivityManager)
mContext.getSystemService(Context.ACTIVITY_SERVICE);
ArrayList
rti=(ArrayList
String currenact = rti.get(0).topActivity.getPackageName().toString();
if(currenact.equals(mContext.getPackageName().toString()))
return true;
return false;
}
No comments:
Post a Comment