3

I'm developing an app which will be used by children.

I took over the home button by making my app a launcher. Now I'm trying to take over the long press of the home button which brings up the recent apps list.

I searched for and tried:

  • taking over the button
  • clearing the apps list
  • killBackgroundProcesses() and Process.killProcess()

I'm able to get the tasks by ActivityManager.getRunningTasks(), but I can't seem to clear it in any way.

I've come across two possible solutions:

  • listening to onWindowFocusChanged and Intent.ACTION_CLOSE_SYSTEM_DIALOGS => this is not an acceptable answer for my requirements
  • doing it like ToddlerLock and flood the apps list with activities => this is a hack and in the future it might not work anymore

Is there another possibility (except building a custom rom) or am I missing something? Thanks in advance!

EDIT 1: I was able to kill other running processes but their entry remained in the recent apps list, so if you click it, it will just restart that application. Is there a way to refresh that list?

EDIT 2: I tried to do it like ToddlerLock and followed the directions of Robert's answer. I've got 18 dummy activities running and showing in the recent apps list, but this doesn't block the possibility to click previous active apps. Any help?

Community
  • 1
  • 1
joekeee
  • 108
  • 1
  • 10
  • I am also fighting with the recent apps list on Android 4.1, but in my case it is about preventing my app from being "swipe killed" - did you prevent it somehow? Whatever you do, your app will always be shown on first position of the list... It would be best to block the list at all - "avast! Mobile Security" does that on its anti-theft screen, but I don't know yet how to do that - maybe it has to work as a lock screen somehow? That's a clue only, maybe it will help you somehow – Koger May 15 '13 at 15:19
  • I believe there are several ways for your app to prevent it from showing in the recent apps list: the easiest is putting this in your manifest 'android:excludeFromRecents="true"' that should work. Mine doesn't show up in the list because mine is set as a launcher. Blocking or clearing the list is indeed what I want to achieve, the lock screen might be an option but I already made it into a launcher and tend to keep it that way. – joekeee May 15 '13 at 16:53
  • http://stackoverflow.com/questions/6258980/altering-the-result-of-getrecenttasks – Abdullah Shoaib Feb 18 '14 at 07:56

0 Answers0