当前位置: 首页>>代码示例>>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;未经允许,请勿转载。