首次进入app,退到桌面在进入会重启启动页问题(首次装app,点击推送会重启app)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/stimgo/article/details/86686183
  1. 在launch活动页面的onCreate()方法的setContentView()方法前面
    添加
if (!this.isTaskRoot()) {
            Intent mainIntent = getIntent();
            String action = mainIntent.getAction();
            if (mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
                finish();
                return;
            }
        }
  1. 在启动页的清单配置里配
     android:alwaysRetainTaskState="true"
            android:clearTaskOnLaunch="false"

猜你喜欢

转载自blog.csdn.net/stimgo/article/details/86686183