admobadsensesniffer

Hide Admob APP ID From Sniffer/Modder/Hacker


**Hello,

Is there anyway to hide admob APP ID, So That it can't be revealed to the Sniffer/Hackers/Modders. I recive Ads Unit and Admob APP ID Remotely from my APP Panel. How Can I not use App id in manifest/String.

Please Provide Your Valuable Suggestion.

**


Solution

  • The possibility of maliciously attacking via your AD-unit-ID is slim. However, someone could still use your APP-ID and AD-unit-ID to generate an invalid traffic which leads your AdMob account suspended.

    According to this document, you may put these IDs in your build.gradle file and automatically switch your test-AD-IDs / real-AD-IDs by selecting different build types.

    Here is my code in app/build.gradle

    buildTypes {
        debug {
            applicationIdSuffix ".debug"
            resValue "string", "app_name", "@string/app_name_debug"
            resValue "string", "ad_banner_id",   "ca-app-pub-3940256099942544/6300978111"  // test unit id
            resValue "string", "ad_rewarded_id", "ca-app-pub-3940256099942544/5224354917"  // test unit id
        }
    
        release {
            resValue "string", "app_name", "@string/app_name_release"
            resValue "string", "ad_banner_id",   "ca-app-pub-***/***"  // real ad unit id
            resValue "string", "ad_rewarded_id", "ca-app-pub-***/***"  // real ad unit id
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            zipAlignEnabled true
        }
    }