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


Java ActivityManager.moveTaskToFront方法代碼示例

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


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

示例1: isAppOnForeground

import android.app.ActivityManager; //導入方法依賴的package包/類
@SuppressLint({"NewApi"})
public static boolean isAppOnForeground(Context mContext) {
    ActivityManager activityManager = (ActivityManager) mContext.getSystemService("activity");
    String packageName = mContext.getPackageName();
    LogInfo.log("PushReceiver", "packageName =" + packageName);
    List<RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses();
    if (appProcesses == null) {
        LogInfo.log("PushReceiver", "------appProcesses == null-----");
        return false;
    }
    for (RunningAppProcessInfo appProcess : appProcesses) {
        LogInfo.log("PushReceiver", "------appProcess.processName =" + appProcess.processName);
        if (appProcess.processName.equals(packageName) && appProcess.importance == 100) {
            for (RunningTaskInfo rti : activityManager.getRunningTasks(100)) {
                if (!(rti == null || rti.baseActivity == null || mContext.getPackageName() == null || !mContext.getPackageName().equals(rti.baseActivity.getPackageName()) || VERSION.SDK_INT < 11)) {
                    activityManager.moveTaskToFront(rti.id, 1);
                }
            }
            return true;
        }
    }
    return false;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:24,代碼來源:PushNotificationReceiver.java

示例2: bring2Front

import android.app.ActivityManager; //導入方法依賴的package包/類
/**
    * 將當前應用運行到前台
    */
   private void bring2Front()
   {
       ActivityManager activtyManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
       List<ActivityManager.RunningTaskInfo> runningTaskInfos = activtyManager.getRunningTasks(3);
       for (ActivityManager.RunningTaskInfo runningTaskInfo : runningTaskInfos)
{
           if (this.getPackageName().equals(runningTaskInfo.topActivity.getPackageName()))
    {
               activtyManager.moveTaskToFront(runningTaskInfo.id, ActivityManager.MOVE_TASK_WITH_HOME);
               return;
           }
       }
   }
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:17,代碼來源:AppCompatDlalog.java

示例3: onPause

import android.app.ActivityManager; //導入方法依賴的package包/類
@Override
protected void onPause() {
	LocalBroadcastManager.getInstance(this).unregisterReceiver(mRegistrationBroadcastReceiver);
	isReceiverRegistered = false;
	ActivityManager activityManager = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
	activityManager.moveTaskToFront(getTaskId(), 0);
	super.onPause();
}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:9,代碼來源:VerifyOTP.java

示例4: pushLiveOver

import android.app.ActivityManager; //導入方法依賴的package包/類
@SuppressLint({"NewApi"})
private void pushLiveOver() {
    LetvConstant.setForcePlay(false);
    StatisticsUtils.setActionProperty(NetworkUtils.DELIMITER_LINE, -1, NetworkUtils.DELIMITER_LINE);
    if (MainActivity.getInstance() != null) {
        if (this.isShowToast) {
            UIsUtils.showToast(TipUtils.getTipMessage("70004", 2131100703));
        }
        ActivityManager am = (ActivityManager) this.mContext.getSystemService("activity");
        for (RunningTaskInfo rti : am.getRunningTasks(100)) {
            if (!(rti == null || rti.baseActivity == null || this.mContext.getPackageName() == null || !this.mContext.getPackageName().equals(rti.baseActivity.getPackageName()))) {
                if (VERSION.SDK_INT >= 11) {
                    am.moveTaskToFront(rti.id, 1);
                }
                LogInfo.log("push_", "moveTaskToFront rti.id = " + rti.id);
            }
        }
        if (TextUtils.isEmpty(this.cid)) {
            MainLaunchUtils.launch(MainActivity.getInstance(), true);
        } else if (!(this.cid.equals("3") || this.cid.equals("8") || this.cid.equals("4") || this.cid.equals("9"))) {
            MainLaunchUtils.launch(MainActivity.getInstance(), true);
        }
        LogInfo.log("push_", "pushLiveOver live pushCid " + this.cid);
        return;
    }
    if (TextUtils.isEmpty(this.cid)) {
        MainLaunchUtils.launch(this.mContext, true);
    } else if (this.cid.equals("3")) {
        MainLaunchUtils.launchGotoLive(this.mContext, "ent", null, this.isShowToast, true);
    } else if (this.cid.equals("8")) {
        MainLaunchUtils.launchGotoLive(this.mContext, "other", null, this.isShowToast, true);
    } else if (this.cid.equals("4")) {
        MainLaunchUtils.launchGotoLive(this.mContext, "sports", null, this.isShowToast, true);
    } else if (this.cid.equals("9")) {
        MainLaunchUtils.launchGotoLive(this.mContext, "music", null, this.isShowToast, true);
    } else {
        MainLaunchUtils.launch(this.mContext, true);
    }
    LogInfo.log("push_", "pushLiveOver MainActivity.getInstance() == null no jump to live");
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:41,代碼來源:PushNotificationReceiver.java

示例5: bring2Front

import android.app.ActivityManager; //導入方法依賴的package包/類
/**
 * 將當前應用運行到前台
 */
private void bring2Front(Context context) {
    ActivityManager activtyManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    List<ActivityManager.RunningTaskInfo> runningTaskInfos = activtyManager.getRunningTasks(3);
    for (ActivityManager.RunningTaskInfo runningTaskInfo : runningTaskInfos) {
        if (context.getPackageName().equals(runningTaskInfo.topActivity.getPackageName())) {
            activtyManager.moveTaskToFront(runningTaskInfo.id, ActivityManager.MOVE_TASK_WITH_HOME);
            return;
        }
    }
}
 
開發者ID:xmlxin,項目名稱:ReplyMessage,代碼行數:14,代碼來源:SystemUtil.java


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