本文整理匯總了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);
}
示例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);
}
示例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();
}
}
示例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);
}
}
示例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) {
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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();
}
}
示例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) { }
}
示例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);
}
}
示例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);
}
}
示例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();
}
}