2013-05-16 19 views
1

我想知道如何可以檢查哪個應用程序在Android中啓動。例如,當某個遊戲啓動或瀏覽器打開時,我的應用程序就會知道這個應用程序已啓動。無論如何要找到這件事嗎?檢查啓動了哪個應用程序?

+0

你嘗試過這種方式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

回答

0

這段代碼是檢查服務推出後,我認爲這是非常有可能與活動

ActivityManager activityManager=(ActivityManager)this.getSystemService(ACTIVITY_SERVICE); 
    List<RunningServiceInfo> list= activityManager.getRunningServices(70); 
相關問題