s1gh7
December 10, 2014, 9:25am
#1
Hi,
I noticed a strange behavior of my exit game button (for Android). Instead of closing the app the call of
Director::getInstance()->end();
close and restart it immediately. Here is the code snipped I use. I think nothing special:
void MyLayer::menuCloseCallback(Ref* pSender)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
cocos2d::Director::getInstance()->end();
#endif
}
I’m using cocos2d-x 3.0 . Any ideas what’s going on here?
3 Likes
s1gh7
December 10, 2014, 9:42am
#2
I’ve figured it out by myself. Another Activity was running in background and restarts the game.
Can you explain it in detail? I have same issue.
i have same issue and resolved. can you explain it in detail?
Very useful post. Great solution provided.
Are you using a recent version?
If I started app by push notification, cocos2d::Director::getInstance()->end(); works not correctly.
When I open application by notification, I creat new Activity. I solved this issue by adding android:launchMode=“singleInstance” to my activity in manifest.
How did you decide to do this? I wonder if we need this in newer versions.
I created a new activity when open my app by push. It was my problem.
I choose other flags when creating intent for push and changed activity launchMode.
I think this post will be enough.