2

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

If so, how to do that?

4

2 回答 2

1

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.

于 2015-02-03T01:51:56.863 回答
0

Try this

   android.os.Process.killProcess(android.os.Process.myPid());
于 2015-02-01T04:53:16.743 回答