取消CocosCreator的AppActivity的默认启用,程序启动时启动其他的原生Activity,
再由原生Activity启动CocosCreator的AppActivity,就直接闪退了。
这种操作需要加什么额外的操作吗?
启动代码很简单:
Intent intent = new Intent(this, AppActivity.class);
startActivity(intent);
报错:
取消CocosCreator的AppActivity的默认启用,程序启动时启动其他的原生Activity,
再由原生Activity启动CocosCreator的AppActivity,就直接闪退了。
这种操作需要加什么额外的操作吗?
启动代码很简单:
Intent intent = new Intent(this, AppActivity.class);
startActivity(intent);
报错:
从报错上看,启动就直接跳到了Activity的onDestory上了。
是需要传递什么参数做初始化?
默认启动的Activity只是个空Activity, 没有任何功能,一个按钮启动Cocos的AppActivity这样。
CocosCreator版本1.9.3
Cocos2dxActivity.onCreate()里面这些注释掉就好了
if (!isTaskRoot()) {
// Android launched another instance of the root activity into an existing task
// so just quietly finish and go away, dropping the user back into the activity
// at the top of the stack (ie: the last state of this task)
finish();
Log.w(TAG, “[Workaround] Ignore the activity started from icon!”);
return;
}
AppActivity.onCreate()里面做同样的处理
卧槽,感谢兄台的记录。我一直没注意Cocos2dxActivity中还有isTaskRoot判断,真操蛋,简单的activity跳转始终不成功,还以为什么乱七八糟问题,tnnd,耽误半天时间,真窝火。
感谢兄台的无私奉献。