static public void isAddGoogleAds( final int reward)
{
// 添加到主线程 //谷歌广告回调c++必须添加@JavascriptInterface 否则4.x的版本会卡死
app.runOnUiThread(new Runnable() {
@Override
@JavascriptInterface
public void run() {
finalboolean isAdd;
if (app.mInterstitialAd.isLoaded()) {
app.mInterstitialAd.show();
isAdd = true;
}
else{
app.requestNewInterstitial();
isAdd = false;
}
System.out.print("reward="+reward+"isAdd"+isAdd);
Cocos2dxGLSurfaceView.getInstance().queueEvent(new Runnable() {
@Override
@JavascriptInterface
publicvoid run() {
app.GoogleAdsCallback(reward, isAdd);
}
});
}
});
}