app首次安装完成后在安装界面直接“打开”应用再按home键返回桌面,从桌面上点击APP图标,会出现两个HomeActivity

   @Override
    protected void onCreate(Bundle savedInstanceState) {
        setTheme(R.style.SplashTheme);
        super.onCreate(savedInstanceState);
        //首次安装按home键置入后台,从桌面图标点击重新启动的问题
        if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
            finish();
            return;
        }

        if (!isTaskRoot()) {
            final Intent intent = getIntent();
            final String intentAction = intent.getAction();
            if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && intentAction != null && intentAction.equals(Intent
                    .ACTION_MAIN)) {
                finish();
                return;
            }
        }

        setContentView(R.layout.view_new_home);
}

你可能感兴趣的:(app首次安装完成后在安装界面直接“打开”应用再按home键返回桌面,从桌面上点击APP图标,会出现两个HomeActivity)