Created
March 26, 2018 08:30
-
-
Save mattermon/adbf2620658f1107e9b0bffc4487cbbf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String getTopAppName(){ | |
ActivityManager activityManager=(ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); | |
String topPackage=activityManager.getRunningTasks(1).get(0).topActivity.getPackageName(); | |
return topPackage; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment