-1

Now there are some memory mananger tool apps that can clean system memory in google market. How does them work? I think they only can invoke System.gc(). Because application must get root permission to stop other services and processes.

4

1 回答 1

0

Here is my taskmaneger source: http://code.google.com/p/my-test-project-lion/ The basic method is ActivityManager.killBackgroundProcess

    public void killSelf(Context context) {
            ActivityManager am = (ActivityManager) context
                            .getSystemService(Activity.ACTIVITY_SERVICE);
            am.killBackgroundProcesses(getPackageName());

            if (mServiceList != null) {
                    for (RunningServiceInfo service : mServiceList) {
                            context.stopService(new Intent().setComponent(service.service));
                    }
            }
    }
于 2013-04-26T03:06:00.870 回答