Detecting android Activity launches

后端 未结 1 1195
囚心锁ツ
囚心锁ツ 2021-02-14 02:38

I have searched the stackoverflow for this question and found : Android, Detect when other apps are launched and Reliable way to detect application launch from home / desktop?

相关标签:
1条回答
  • 2021-02-14 02:58

    Android default recent apps dialog implementation is best reference for you, look here..check reloadButtons()

    final ActivityManager am = (ActivityManager)
                    context.getSystemService(Context.ACTIVITY_SERVICE);
            final List<ActivityManager.RecentTaskInfo> recentTasks =
                    am.getRecentTasks(MAX_RECENT_TASKS, ActivityManager.RECENT_IGNORE_UNAVAILABLE);
    

    You can try in similar way..

    0 讨论(0)
提交回复
热议问题