Search code examples
androidandroid-4.2-jelly-beanandroid-package-managersandroid-4.3-jelly-beangoogle-now

How to programmatically force quit (or temporarily disable) Google App


Is there a way to force-quit Google App (AKA Google Search) from my app?

If so, how to do that?


Solution

  • In general, you will need ActivityManager's killBackgroundProcesses():

      public static void killOtherPackage(Context ctx) {
            if (ctx != null) {      
            ActivityManager am = (ActivityManager) ctx.getSystemService(ctx.ACTIVITY_SERVICE);
            if (am != null)
                am.killBackgroundProcesses("com.comp.prodline.specificpack");
            }
    
      }
    

    Plus android.permission.KILL_BACKGROUND_PROCESSES in the manifest.

    But I doubt that you will succeed killing Google's app.

    More on this can be found in this thread.