How to solve this. I have added a notification when user will see ads. Now where is the problem. My code is here.
public class AdMobAds {
private Context context;
public AdMobAds(Context context){
this.context = context;
}
private final String AD_UNIT_ID = "ca-app-pub-9323045181924630/1652450256";
private RewardedAd rewardedAd;
public String button = "";
public void loadRewardedAd() {
if (rewardedAd == null) {
AdRequest adRequest = new AdRequest.Builder().build();
RewardedAd.load(
context,
AD_UNIT_ID,
adRequest,
new RewardedAdLoadCallback() {
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
// Handle the error.
//Log.d(TAG, loadAdError.getMessage());
rewardedAd = null;
loadRewardedAd();
//MainActivity.this.isLoading = false;
//Toast.makeText(context, "onAdFailedToLoad", Toast.LENGTH_SHORT).show();
}
@Override
public void onAdLoaded(@NonNull RewardedAd rewardedAd) {
AdMobAds.this.rewardedAd = rewardedAd;
button = "ON";
//Log.d(TAG, "onAdLoaded");
//MainActivity.this.isLoading = false;
//Toast.makeText(context, "onAdLoaded", Toast.LENGTH_SHORT).show();
}
});
}
}
public void showRewardedVideo() {
if (rewardedAd == null) {
//Log.d("TAG", "The rewarded ad wasn't ready yet.");
//Toast.makeText(context, "ads not work", Toast.LENGTH_SHORT).show();
loadRewardedAd();
return;
}else{
rewardedAd.show((Activity) context, new OnUserEarnedRewardListener() {
@Override
public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
Toast.makeText(context, "Mining Start", Toast.LENGTH_SHORT).show();
}
});
}
rewardedAd.setFullScreenContentCallback(
new FullScreenContentCallback() {
@Override
public void onAdShowedFullScreenContent() {
// Called when ad is shown.
//Log.d("TAG", "onAdShowedFullScreenContent");
//Toast.makeText(context, "onAdShowedFullScreenContent", Toast.LENGTH_SHORT).show();
}
@Override
public void onAdFailedToShowFullScreenContent(AdError adError) {
// Called when ad fails to show.
//Log.d("TAG", "onAdFailedToShowFullScreenContent");
// Don't forget to set the ad reference to null so you
// don't show the ad a second time.
rewardedAd = null;
//Toast.makeText(context, "onAdFailedToShowFullScreenContent", Toast.LENGTH_SHORT).show();
}
@Override
public void onAdDismissedFullScreenContent() {
// Called when ad is dismissed.
// Don't forget to set the ad reference to null so you
// don't show the ad a second time.
rewardedAd = null;
button = "";
//Log.d("TAG", "onAdDismissedFullScreenContent");
//Toast.makeText(context, "onAdDismissedFullScreenContent", Toast.LENGTH_SHORT).show();
// Preload the next rewarded ad.
loadRewardedAd();
}
});
}
}
What I can do now?
When user want to run a ads they will get a dialog for ads notification. Now they limit my ads. I don't understand what I can do. I knocked in admob support community they do mot give any reply.