作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
//这是我的代码
package name.ratson.cordova.admob.rewardvideo;
import android.util.Log;
import com.google.android.gms.ads.reward.RewardItem;
import com.google.android.gms.ads.reward.RewardedVideoAdListener;
import org.json.JSONException;
import org.json.JSONObject;
import name.ratson.cordova.admob.AbstractExecutor;
class RewardVideoListener implements RewardedVideoAdListener {
private final RewardVideoExecutor executor;
RewardVideoListener(RewardVideoExecutor executor) {
this.executor = executor;
}
@Override
public void onRewardedVideoAdFailedToLoad(int errorCode) {
synchronized (executor.rewardedVideoLock) {
executor.isRewardedVideoLoading = false;
}
JSONObject data = new JSONObject();
try {
data.put("error", errorCode);
data.put("reason", AbstractExecutor.getErrorReason(errorCode));
data.put("adType", executor.getAdType());
} catch (JSONException e) {
e.printStackTrace();
}
executor.fireAdEvent("admob.rewardvideo.events.LOAD_FAIL", data);
}
@Override
public void onRewardedVideoAdLeftApplication() {
JSONObject data = new JSONObject();
try {
data.put("adType", executor.getAdType());
} catch (JSONException e) {
e.printStackTrace();
}
executor.fireAdEvent("admob.rewardvideo.events.EXIT_APP", data);
}
@Override
public void onRewardedVideoAdLoaded() {
synchronized (executor.rewardedVideoLock) {
executor.isRewardedVideoLoading = false;
}
Log.w("AdMob", "RewardedVideoAdLoaded");
executor.fireAdEvent("admob.rewardvideo.events.LOAD");
if (executor.shouldAutoShow()) {
executor.showAd(true, null);
}
}
@Override
public void onRewardedVideoAdOpened() {
executor.fireAdEvent("admob.rewardvideo.events.OPEN");
}
@Override
public void onRewardedVideoStarted() {
executor.fireAdEvent("admob.rewardvideo.events.START");
}
@Override
public void onRewardedVideoAdClosed() {
executor.fireAdEvent("admob.rewardvideo.events.CLOSE");
executor.clearAd();
}
@Override
public void onRewarded(RewardItem reward) {
JSONObject data = new JSONObject();
try {
data.put("adType", executor.getAdType());
data.put("rewardType", reward.getType());
data.put("rewardAmount", reward.getAmount());
} catch (JSONException e) {
e.printStackTrace();
}
executor.fireAdEvent("admob.rewardvideo.events.REWARD", data);
}
}
最佳答案
您的 RewardVideoListener 类正在接口(interface)中实现 RewardedVideoAdListener。
为了使用 RewardedVideoAdListener 接口(interface)进行编译,您需要实现包括 RewardedVideoAdListener 在内的所有接口(interface)方法。
所以把这个添加到你的类(class):
@Override
public void onRewardedVideoCompleted() {
Toast.makeText(this, "onRewardedVideoCompleted", Toast.LENGTH_SHORT).show();
}
关于ionic-framework - RewardVideoListener 不是抽象的,不会覆盖 RewardedVideoAdListener 中的抽象方法 onRewardedVideoCompleted(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49504670/
//这是我的代码 package name.ratson.cordova.admob.rewardvideo; import android.util.Log; import com.google.a
我是一名优秀的程序员,十分优秀!