It works proper in most webpages but only when a paypal page is open in webview, and I tap back button it closes the app, otherwise it hides the webview and shows app homepage as I want.
So i think the problem is of focus, as paypal page must be changing the focus as mentioned in the above link.
Am I right? and if so how to use the above code in newer cocos version any idea?