1

I need some help finding a code for this application I'm working on that is supposed to function as follow:

Whenever the user tries to open an installed application on his phone, he'll be automatically transferred to the home page launcher.

I have the code to get me to the home page launcher, but i need use it whenever the user run an app.

the code:`

        Intent homeIntent = new Intent(Intent.ACTION_MAIN);
        homeIntent.addCategory(Intent.CATEGORY_HOME);
        homeIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(homeIntent);`
Abdallah Sabri
  • 53
  • 1
  • 1
  • 9
  • 1
    Whenever the user tries to start *any* app? I have to ask.. **why**? – DoubleDouble Mar 23 '15 at 20:15
  • It's a kids mode application for my graduation project. – Abdallah Sabri Mar 23 '15 at 20:17
  • What you want to write [already exists](https://android.googlesource.com/platform/packages/apps/Launcher2.git). – MarsAtomic Mar 23 '15 at 20:58
  • No, I want to know whenever an app starts and launch this code. – Abdallah Sabri Mar 23 '15 at 21:00
  • 1
    some relevant links about cancelling the started process, definitely check the first one: http://stackoverflow.com/questions/17141412/prevent-android-application-from-starting http://stackoverflow.com/questions/8814696/how-to-kill-currently-running-task-in-android http://stackoverflow.com/questions/12036895/kill-another-application-in-android http://stackoverflow.com/questions/3773516/how-to-close-another-app-in-android/3774483#3774483 – DoubleDouble Mar 23 '15 at 21:02

0 Answers0