Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.ActivityManager;
import android.content.Context;

public class Main {
    public static void killProcess(Context ctx, String pkgName) {
        ActivityManager actManager = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE);
        // version 1.5 - 2.1
        if (android.os.Build.VERSION.SDK_INT <= 7) {
            actManager.restartPackage(pkgName);
        }
        // version 2.2+
        else {
            actManager.killBackgroundProcesses(pkgName);
        }
    }
}