Skip to content

Commit

Permalink
fix : ads log and interface error message sending
Browse files Browse the repository at this point in the history
  • Loading branch information
FenilInfyom committed Mar 30, 2024
1 parent b003f57 commit 262ae4e
Show file tree
Hide file tree
Showing 42 changed files with 82 additions and 38 deletions.
Binary file removed .gradle/7.5/checksums/checksums.lock
Binary file not shown.
Binary file removed .gradle/7.5/checksums/md5-checksums.bin
Binary file not shown.
Binary file removed .gradle/7.5/checksums/sha1-checksums.bin
Binary file not shown.
Binary file not shown.
Empty file.
Binary file removed .gradle/7.5/executionHistory/executionHistory.bin
Binary file not shown.
Binary file removed .gradle/7.5/executionHistory/executionHistory.lock
Binary file not shown.
Binary file removed .gradle/7.5/fileChanges/last-build.bin
Binary file not shown.
Binary file removed .gradle/7.5/fileHashes/fileHashes.bin
Binary file not shown.
Binary file removed .gradle/7.5/fileHashes/fileHashes.lock
Binary file not shown.
Binary file removed .gradle/7.5/fileHashes/resourceHashesCache.bin
Binary file not shown.
Empty file removed .gradle/7.5/gc.properties
Empty file.
Binary file modified .gradle/8.4/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/8.4/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/8.4/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/8.4/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/8.4/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file modified .gradle/file-system.probe
Binary file not shown.
15 changes: 14 additions & 1 deletion .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions adsSdk/src/main/java/com/infyom/adssdk/InfyOmAds.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.RelativeLayout;

Expand Down Expand Up @@ -123,12 +124,12 @@ public static void showInterstitial(int admob, Context context, Interstitial lis
Constants.isAdLoading = true;
InterstitialUtilsFb.loadInterstitial(context, listener, null );
} else {
listener.onAdClose(false);
listener.onAdClose("Different Ads Type");
}

} else {
Constants.isAdLoading = false;
listener.onAdClose(true);
listener.onAdClose("Ads time running");
}
}

Expand Down Expand Up @@ -227,11 +228,9 @@ public static void showNative(Context context, RelativeLayout nativeContainer, V

public static void initializeAds(Context context) {
MobileAds.initialize(context, initializationStatus -> {
Log.e("ADS_SDK-->", "initializeAds: "+initializationStatus.toString());
});
AudienceNetworkAds.initialize(context);
if (BuildConfig.DEBUG) {
AdSettings.setTestMode(true);
}
}

public static void enableTestMode(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public static void loadBannerAd() {
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
Log.e("AD-BANNER", "failed : " +loadAdError.toString());
Log.e("ADS_SDK-->", "failed : " +loadAdError.toString());
// BannerUtilsFb.loadFbBanner(context, rlBanner,mSpace);
}

@Override
public void onAdLoaded() {
super.onAdLoaded();
Log.e("AD-BANNER", "load_ads : success call" );
Log.e("ADS_SDK-->", "load_ads : success call" );
// loadFailed = 0;
// setAdView( finalAdView );
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
Constants.adView = null;
if (InfyOmAds.isConnectingToInternet(context)) {
if (loadFailed != 3) {
Log.e("B_TAG", "onAdFailedToLoad: "+loadFailed );
Log.e("ADS_SDK-->", "onAdFailedToLoad: "+loadFailed );
loadFailed++;
load_ads(context, bannerView, adMobId,true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void loadFbBanner(Context context, RelativeLayout adContainer, Vie
adView.loadAd(adView.buildLoadAdConfig().withAdListener(new AdListener() {
@Override
public void onError(Ad ad, AdError adError) {
Log.e("BANNER_ERROR-->", adError.getErrorMessage());
Log.e("ADS_SDK-->", adError.getErrorMessage());
adContainer.setVisibility(View.GONE);
space.setVisibility(View.VISIBLE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public static void loadBannerAd(InfyOmAds.BannerAdTemplate bannerAdTemplate) {
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
Log.e("AD-BANNER", "failed : " +loadAdError.toString());
Log.e("ADS_SDK-->", "failed : " +loadAdError.toString());
// BannerUtilsFb.loadFbBanner(context, rlBanner,mSpace);
}

@Override
public void onAdLoaded() {
super.onAdLoaded();
Log.e("AD-BANNER", "load_ads : success call" );
Log.e("ADS_SDK-->", "load_ads : success call" );
// loadFailed = 0;
// setAdView( finalAdView );
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public void loadInterstitial() {
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
Log.e("INTER_TAG-->", "onAdFailedToLoad: Failed ads");
InterstitialUtilsFb.loadInterstitial(mContext,listener,dialog);

}
Expand Down Expand Up @@ -129,13 +128,13 @@ public void run() {
Constants.isTimeFinish = true;
}
}, myPref.getAdsTime() * 1000);
listener.onAdClose(true);
listener.onAdClose("Dismiss");
}

@Override
public void onAdFailedToShowFullScreenContent(@NonNull AdError adError) {
super.onAdFailedToShowFullScreenContent(adError);
listener.onAdClose(true);
listener.onAdClose(adError.toString());

}
});
Expand All @@ -155,7 +154,7 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
if (InfyOmAds.isConnectingToInternet(mContext)) {
if (failedPreLoad == 3) {
failedPreLoad = 0;
Log.e("I_TAG", "onAdFailedToLoad: "+failedPreLoad );
Log.e("ADS_SDK-->", "onAdFailedToLoad: "+failedPreLoad );
} else {
failedPreLoad++;
loadPreInterstitialAd(mContext, mUnitId,adRequest);
Expand All @@ -169,7 +168,7 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
@Override
public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
super.onAdLoaded(interstitialAd);
Log.e("I_TAG", "onAdLoaded: " );
Log.e("ADS_SDK-->", "onAdLoaded: " );
failedPreLoad = 0;
setCountDown();
mInterstitialAd = interstitialAd;
Expand Down Expand Up @@ -198,7 +197,7 @@ public void onAdShowedFullScreenContent() {
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
}
Log.e("I_TAG", "onAdShowedFullScreenContent: " );
Log.e("ADS_SDK-->", "onAdShowedFullScreenContent: " );
dismissCount();
Constants.isAdShowing = true;
mInterstitialAd = null;
Expand All @@ -217,13 +216,13 @@ public void run() {
Constants.isTimeFinish = true;
}
}, myPref.getAdsTime() * 1000);
listener.onAdClose(true);
listener.onAdClose("Dismiss");
}

@Override
public void onAdFailedToShowFullScreenContent(@NonNull AdError adError) {
super.onAdFailedToShowFullScreenContent(adError);
Log.e("I_TAG", "onAdFailedToShowFullScreenContent: " );
Log.e("ADS_SDK-->", "onAdFailedToShowFullScreenContent: " );
mInterstitialAd = null;
dismissCount();
Constants.isAdShowing = false;
Expand All @@ -234,7 +233,7 @@ public void run() {
Constants.isTimeFinish = true;
}
}, myPref.getAdsTime() * 1000);
listener.onAdClose(true);
listener.onAdClose(adError.getMessage());

}
});
Expand All @@ -252,7 +251,6 @@ public void loadFailedInterstitialAd(Context mContext,String mUnitId,Interstiti
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
Log.e("I_TAG", "onAdFailedToLoad: " );
if (dialog1.isShowing()) {
dialog1.dismiss();
}
Expand All @@ -264,13 +262,13 @@ public void run() {
Constants.isTimeFinish = true;
}
}, myPref.getAdsTime() * 1000);
listener.onAdClose(true);
listener.onAdClose(loadAdError.toString());
}

@Override
public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
super.onAdLoaded(interstitialAd);
Log.e("I_TAG", "onAdLoaded: " );
Log.e("ADS_SDK-->", "onAdLoaded: " );
interstitialAd.show((Activity) mContext);
interstitialAd.setFullScreenContentCallback(new FullScreenContentCallback() {
@Override
Expand All @@ -281,7 +279,7 @@ public void onAdClicked() {
@Override
public void onAdShowedFullScreenContent() {
super.onAdShowedFullScreenContent();
Log.e("I_TAG", "onAdShowedFullScreenContent: " );
Log.e("ADS_SDK-->", "onAdShowedFullScreenContent: " );
if (dialog1.isShowing()) {
dialog1.dismiss();
}
Expand All @@ -291,7 +289,7 @@ public void onAdShowedFullScreenContent() {
@Override
public void onAdDismissedFullScreenContent() {
super.onAdDismissedFullScreenContent();
Log.e("I_TAG", "onAdDismissedFullScreenContent: " );
Log.e("ADS_SDK-->", "onAdDismissedFullScreenContent: " );
Constants.isAdShowing = false;
Constants.isTimeFinish = false;
new Handler().postDelayed(new Runnable() {
Expand All @@ -300,13 +298,13 @@ public void run() {
Constants.isTimeFinish = true;
}
}, myPref.getAdsTime() * 1000);
listener.onAdClose(true);
listener.onAdClose("Dismiss");
}

@Override
public void onAdFailedToShowFullScreenContent(@NonNull AdError adError) {
super.onAdFailedToShowFullScreenContent(adError);
Log.e("I_TAG", "onAdFailedToShowFullScreenContent: " );
Log.e("ADS_SDK-->", "onAdFailedToShowFullScreenContent: " );
if (dialog1.isShowing()) {
dialog1.dismiss();
}
Expand All @@ -318,7 +316,7 @@ public void run() {
Constants.isTimeFinish = true;
}
}, myPref.getAdsTime() * 1000);
listener.onAdClose(true);
listener.onAdClose(adError.getMessage());
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public void run() {
Constants.isTimeFinish = true;
}
},accountProvider.getAdsTime() * 1000);
listener.onAdClose(false);
listener.onAdClose("Fb Dismiss");
}

@Override
public void onError(Ad ad, AdError adError) {
Log.e("INTER_ERROR-->", "Interstitial ad failed to load: " + adError.getErrorMessage());
Log.e("ADS_SDK-->", "Interstitial ad failed to load: " + adError.getErrorMessage());
if (finalDialog.isShowing()) {
finalDialog.dismiss();
}
Expand All @@ -67,7 +67,7 @@ public void run() {
Constants.isTimeFinish = true;
}
}, accountProvider.getAdsTime() * 1000);
listener.onAdClose(true);
listener.onAdClose(adError.getErrorMessage().toString());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public void run() {
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
Log.e("ADS_SDK-->", "Native ad failed to load: " + loadAdError.toString());
Constants.nativeAds = null;
NativeUtilsFb.loadFbNative(context,rlNative,space,isBigNative);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public void run() {
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
Log.e("ADS_SDK-->", "Native ad failed to load: " + loadAdError.toString());
Constants.nativeAds = null;

NativeUtilsFb.loadFbNative(context, rlNative, space,false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public void run() {
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
Log.e("ADS_SDK-->", "Native ad failed to load: " + loadAdError.toString());
mNativeAd = null;
NativeUtilsFb.loadFbNative(context,rlNative,space,true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import android.content.Context;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
Expand Down Expand Up @@ -77,6 +78,7 @@ public void run() {
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
Log.e("ADS_SDK-->", "Native ad failed to load: " + loadAdError.toString());
try {
Constants.nativeAds = null;
// space.setVisibility(View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
Expand Down Expand Up @@ -88,6 +89,7 @@ public void run() {
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
Log.e("ADS_SDK-->", "Native ad failed to load: " + loadAdError.toString());
try {
Constants.nativeAds = null;
// space.setVisibility(View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void onAdClicked() {
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
Log.e("ADS_SDK-->", "Native ad failed to load: " + loadAdError.toString());
Constants.nativeAds = null;
// if (InfyOmAds.isConnectingToInternet(context)) {
// if (loadFailed != 3) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public void onError(Ad ad, AdError adError) {

nativeAdLayout.setVisibility(View.GONE);
if (InfyOmAds.isConnectingToInternet(context)) {
Log.e("N_F_TAG", "onError: ");
Log.e("ADS_SDK-->", "Native ad failed to load: " + adError.getErrorMessage());
Log.e("ADS_SDK-->", "Native ad failed to load: " + adError.getErrorCode());
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.infyom.adssdk.aditerface;

public interface Interstitial {
void onAdClose(boolean isFail);
void onAdClose(String errorMessage);
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" >

<application
android:name=".MyApp"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
Expand Down Expand Up @@ -36,9 +37,11 @@ protected void onCreate(Bundle savedInstanceState) {
showAds.setOnClickListener(v -> {
InfyOmAds.showInterstitial(2, this, new Interstitial() {
@Override
public void onAdClose(boolean isFail) {
public void onAdClose(String errorMessage) {
Log.e("ADS_SDK-->", "onAdClose: "+errorMessage );
startActivity(new Intent(Main2Activity.this,MainActivity3.class));
}

});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ protected void onCreate(Bundle savedInstanceState) {
showAds.setOnClickListener(v -> {
InfyOmAds.showInterstitial(1, this, new Interstitial() {
@Override
public void onAdClose(boolean isFail) {
public void onAdClose(String errorMessage) {
startActivity(new Intent(MainActivity.this,Main2Activity.class));
Log.e("ADS_SDK-->", "onAdClose: "+errorMessage );
}
});
});
Expand Down
Loading

0 comments on commit 262ae4e

Please sign in to comment.