當前位置: 首頁>>代碼示例>>Java>>正文


Java ActivityManager.killBackgroundProcesses方法代碼示例

本文整理匯總了Java中android.app.ActivityManager.killBackgroundProcesses方法的典型用法代碼示例。如果您正苦於以下問題:Java ActivityManager.killBackgroundProcesses方法的具體用法?Java ActivityManager.killBackgroundProcesses怎麽用?Java ActivityManager.killBackgroundProcesses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.ActivityManager的用法示例。


在下文中一共展示了ActivityManager.killBackgroundProcesses方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: b

import android.app.ActivityManager; //導入方法依賴的package包/類
private void b()
{

    mHandler.sendEmptyMessage(0x1);

    ActivityManager activityManager = (ActivityManager)smali_layout_apktool.this.getSystemService(ACTIVITY_SERVICE);

    if (processNamelist != null && processNamelist.size() > 0)
    {
        for (String processName : processNamelist)
        {
            activityManager.killBackgroundProcesses(processName);
        }
    }
    mHandler.sendEmptyMessageDelayed(0x2, 2000);
}
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:17,代碼來源:smali_layout_apktool.java

示例2: b

import android.app.ActivityManager; //導入方法依賴的package包/類
/**
 * 一鍵清理
 */
private void b()
{

    mHandler.sendEmptyMessage(0x1);

    ActivityManager activityManager = (ActivityManager)KILL.this.getSystemService(ACTIVITY_SERVICE);

    if (processNamelist != null && processNamelist.size() > 0)
    {
        for (String processName : processNamelist)
        {
            activityManager.killBackgroundProcesses(processName);
        }
    }
    mHandler.sendEmptyMessageDelayed(0x2, 2000);
}
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:20,代碼來源:KILL.java

示例3: appExit

import android.app.ActivityManager; //導入方法依賴的package包/類
/**
 * 退出應用程序
 */
public void appExit() {
    try {
        killAll();
        release();
        if (mActivityList != null)
            mActivityList = null;
        ActivityManager activityMgr =
                (ActivityManager) mApplication.getSystemService(Context.ACTIVITY_SERVICE);
        activityMgr.killBackgroundProcesses(mApplication.getPackageName());
        mApplication = null;
        activityMgr = null;
        System.exit(0);
        for (int i = 0; i < 100; i++) {
            System.gc();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:devzwy,項目名稱:NeiHanDuanZiTV,代碼行數:23,代碼來源:AppManager.java

示例4: onReceive

import android.app.ActivityManager; //導入方法依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
    super.onReceive(context, intent);

    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);

    int widgetId = intent.getIntExtra(WIDGET_ID, 0);
    int appIndex = intent.getIntExtra(APPLICATION_INDEX, 0);

    if (KILL_CLICKED.equals(intent.getAction())) {
        ApplicationInfo applicationInfo = debugApps.get(appIndex);
        ActivityManager systemService = (ActivityManager) context.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
        systemService.killBackgroundProcesses(applicationInfo.packageName);
        Toast.makeText(context, context.getString(R.string.kill_process, applicationInfo.packageName), Toast.LENGTH_SHORT).show();
    } else if (IMAGE_CLICKED.equals(intent.getAction())) {
        appIndex = ++appIndex < debugApps.size() - 1 ? appIndex : 0;
        setupRemoteViews(context, appWidgetManager, remoteViews, widgetId, appIndex);
    }
}
 
開發者ID:EmmettWilson,項目名稱:AppTerminator,代碼行數:21,代碼來源:TerminatorWidgetProvider.java

示例5: AppExit

import android.app.ActivityManager; //導入方法依賴的package包/類
/**
 * 退出應用程序
 */
public void AppExit(Context context) {
    try {
        finishAllActivity();
        ActivityManager activityMgr =
                (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        activityMgr.killBackgroundProcesses(context.getPackageName());
        System.exit(0);
    } catch (Exception e) {
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:AppManager.java

示例6: AppExit

import android.app.ActivityManager; //導入方法依賴的package包/類
/**
 * 退出應用程序
 */
public void AppExit() {
    try {
        killAll();
        if (mActivityList != null)
            mActivityList = null;
        ActivityManager activityMgr =
                (ActivityManager) mApplication.getSystemService(Context.ACTIVITY_SERVICE);
        activityMgr.killBackgroundProcesses(mApplication.getPackageName());
        System.exit(0);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:AppManager.java

示例7: exitApp

import android.app.ActivityManager; //導入方法依賴的package包/類
public void exitApp(Context context) {
    try {
        clear();
        ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        manager.killBackgroundProcesses(context.getPackageName());
        System.exit(0);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:Res2013,項目名稱:MyCleanArchitecture,代碼行數:11,代碼來源:ActivitiesManager.java

示例8: AppExit

import android.app.ActivityManager; //導入方法依賴的package包/類
/**
 * 退出應用程序
 */
public void AppExit() {
    try {
        killAll();
        if (activitys != null){
            activitys = null;
        }
        ActivityManager activityManager = (ActivityManager) application.getSystemService(Context.ACTIVITY_SERVICE);
        activityManager.killBackgroundProcesses(application.getPackageName());
        System.exit(0);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:RockyQu,項目名稱:MVVMFrames,代碼行數:17,代碼來源:AppManager.java

示例9: cleanupMemory

import android.app.ActivityManager; //導入方法依賴的package包/類
public void cleanupMemory(Context context){
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    List<ActivityManager.RunningAppProcessInfo> runningProcessesList = getRunningAppProcessInfo(context);
    for (ActivityManager.RunningAppProcessInfo processInfo : runningProcessesList) {
        activityManager.killBackgroundProcesses(processInfo.processName);
    }
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:8,代碼來源:HomeFragment.java

示例10: appExit

import android.app.ActivityManager; //導入方法依賴的package包/類
/**
 * 退出應用程序
 */
public void appExit() {
    try {
        killAll();
        if (mActivityList != null)
            mActivityList = null;
        ActivityManager activityMgr =
                (ActivityManager) mApplication.getSystemService(Context.ACTIVITY_SERVICE);
        activityMgr.killBackgroundProcesses(mApplication.getPackageName());
        System.exit(0);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:yangxp108,項目名稱:MVPArms_Fragment-fragment,代碼行數:17,代碼來源:AppManager.java

示例11: AppExit

import android.app.ActivityManager; //導入方法依賴的package包/類
/** 
 * 退出應用程序 
 */  
public void AppExit(Context context) {
    try {  
        finishAllActivity();  
        ActivityManager activityMgr= (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        activityMgr.killBackgroundProcesses(context.getPackageName());
        System.exit(0);  
    } catch (Exception e) { }  
}
 
開發者ID:guxiaonian,項目名稱:MeiLa_GNN,代碼行數:12,代碼來源:AppManager.java

示例12: quitApp

import android.app.ActivityManager; //導入方法依賴的package包/類
public static void quitApp(final Context context) {
    if (Build.VERSION.SDK_INT >= 21) {
        ActivityManager am = (ActivityManager) context.getSystemService("activity");
        List appTasks = am.getAppTasks();
        Iterator i$ = appTasks.iterator();

        while (i$.hasNext()) {
            ActivityManager.AppTask appTask = (ActivityManager.AppTask) i$.next();
            appTask.finishAndRemoveTask();
        }

        Process.killProcess(Process.myPid());
        am.killBackgroundProcesses(context.getPackageName());
        System.exit(0);
    } else if (Build.VERSION.SDK_INT >= 11) {
        Intent activityManager = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
        activityManager.addFlags('喜');
        activityManager.addFlags(268435456);
        activityManager.addFlags(67108864);
        activityManager.addFlags(65536);
        activityManager.addFlags(8388608);
        context.startActivity(activityManager);
        (new Handler(Looper.getMainLooper())).postDelayed(new Runnable() {
            public void run() {
                Process.killProcess(Process.myPid());
                System.exit(0);
            }
        }, 300L);
    } else {
        Process.killProcess(Process.myPid());
        ActivityManager activityManager1 = (ActivityManager) context.getSystemService("activity");
        activityManager1.killBackgroundProcesses(context.getPackageName());
        System.exit(0);
    }

}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:37,代碼來源:AppExitUtil.java

示例13: AppExit

import android.app.ActivityManager; //導入方法依賴的package包/類
/**
 * 應用程序退出
 */
public void AppExit(Context context)
{
    try
    {
        finishAllActivity();
        ActivityManager activityMgr = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        activityMgr.killBackgroundProcesses(context.getPackageName());
        System.exit(0);
    } catch (Exception e)
    {
        System.exit(0);
    }
}
 
開發者ID:codeccc,項目名稱:baselibrary-master,代碼行數:17,代碼來源:FragmentActivityManager.java

示例14: AppExit

import android.app.ActivityManager; //導入方法依賴的package包/類
/**
 * 退出應用程序
 */
public void AppExit(Context context) {
    try {
        finishAllActivity();
        ActivityManager activityMgr = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        activityMgr.killBackgroundProcesses(context.getPackageName());
        System.exit(0);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:monsterLin,項目名稱:Pigeon,代碼行數:15,代碼來源:AppManager.java


注:本文中的android.app.ActivityManager.killBackgroundProcesses方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。