automatically Application close when in apps dialog open in cocos2d android

266 Views Asked by At

i am trying implement in apps purchase in cocos2d game. i use extend CCLayer scene() in cocos2d. when i click on button of in-apps purchase than payment dialog is open but my application is close in back-end. i don't know how this happen.

1

There are 1 best solutions below

0
On

i think its due to - finish(). May be you have called the finish() in your onPause(). In my case i mistakenly wrote it in onPause for that reason when i clicked the buy button of IAP, always dialogue appeared but game window closed automatically.

@Override public void onPause() {
        super.onPause();
        CCDirector.sharedDirector().pause();
        //finish();
    } 

After commenting out the finish() method my problem solved. :)