1
我想知道如何可以检查哪个应用程序在Android中启动。例如,当某个游戏启动或浏览器打开时,我的应用程序就会知道这个应用程序已启动。无论如何要找到这件事吗?检查启动了哪个应用程序?
我想知道如何可以检查哪个应用程序在Android中启动。例如,当某个游戏启动或浏览器打开时,我的应用程序就会知道这个应用程序已启动。无论如何要找到这件事吗?检查启动了哪个应用程序?
这段代码是检查服务推出后,我认为这是非常有可能与活动
ActivityManager activityManager=(ActivityManager)this.getSystemService(ACTIVITY_SERVICE);
List<RunningServiceInfo> list= activityManager.getRunningServices(70);
你尝试过这种方式http://stackoverflow.com/questions/3393908/how-to-get-any - 顶级活动的标识符和这个http://stackoverflow.com/questions/3873659/android-how-can-i-get-the-current-foreground-activity-from-a-service? – sandrstar