Commit 598076ec by cuiliang.shi

打开应用 FLAG_ACTIVITY_NEW_TASK

1 parent 26eadf74
......@@ -24,6 +24,15 @@ public class ApiResultCode {
public static void doStartApplicationWithPackageName(String packageName, Context context){
if (packageName.contains("/")){
Intent intentUsb = new Intent();
intentUsb.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ComponentName cpn = new ComponentName(packageName.split("/")[0],
packageName.split("/")[1]);
intentUsb.setComponent(cpn);
context.startActivity(intentUsb);
return;
}
//通过包名获取此App详细信息
PackageInfo packageInfo =null;
try {
......@@ -50,6 +59,8 @@ public class ApiResultCode {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//设置CompoentName
ComponentName cn =new ComponentName(packageName,className);
intent.setComponent(cn);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!