{"id":24369925,"url":"https://github.com/umairoye/interstitialadmanager","last_synced_at":"2026-04-19T23:34:44.730Z","repository":{"id":270952414,"uuid":"911948507","full_name":"UmairOye/InterstitialAdManager","owner":"UmairOye","description":"An open source project which helps you to improve admob interstitial ad show and match rate.","archived":false,"fork":false,"pushed_at":"2025-01-05T11:05:55.000Z","size":107,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T04:10:54.489Z","etag":null,"topics":["admob","admob-sdk","android-app","android-studio","interstitial","interstitial-ads","kotlin-android"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UmairOye.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-04T09:24:18.000Z","updated_at":"2025-01-05T11:05:58.000Z","dependencies_parsed_at":"2025-01-04T10:58:58.035Z","dependency_job_id":"5175dd2d-db09-4955-96b7-4444ee50558e","html_url":"https://github.com/UmairOye/InterstitialAdManager","commit_stats":null,"previous_names":["umairoye/interstitialadmanager"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmairOye%2FInterstitialAdManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmairOye%2FInterstitialAdManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmairOye%2FInterstitialAdManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmairOye%2FInterstitialAdManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UmairOye","download_url":"https://codeload.github.com/UmairOye/InterstitialAdManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243203888,"owners_count":20253367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["admob","admob-sdk","android-app","android-studio","interstitial","interstitial-ads","kotlin-android"],"created_at":"2025-01-19T04:11:03.959Z","updated_at":"2025-12-27T00:45:23.969Z","avatar_url":"https://github.com/UmairOye.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InterstitialAdManager Class\n\n`InterstitialAdManager` is a utility class designed to manage interstitial ads in Android applications using Google AdMob. It handles the loading, showing, and capping of interstitial ads, ensuring they are shown only after a defined time interval to avoid overwhelming the user.\n\n## Features\n\n- **Load Interstitial Ads**: Automatically loads interstitial ads from AdMob.\n- **Display Interstitial Ads**: Shows the interstitial ads at the appropriate moments.\n- **Ad Capping**: Prevents displaying interstitial ads too frequently by enforcing a time gap between consecutive ads.\n- **Network Availability Check**: Ensures that the device has a valid network connection before attempting to load ads.\n- **Loading Dialog**: Displays a loading dialog while the ad is being prepared.\n\n## Class Overview\n\n### Properties\n\n- **mInterstitialAd**: Holds the loaded interstitial ad.\n- **adRequest**: The request used to load an ad from AdMob.\n- **TAG**: Log tag for debugging purposes.\n- **adLoadingDialog**: A custom loading dialog that shows while the interstitial ad is being prepared.\n\n### Functions\n\n#### 1. `loadInterstitialAd(context: Context)`\n   - **Purpose**: Loads an interstitial ad from AdMob if one is not already loaded and the device has a valid network connection.\n   - **Parameters**: \n     - `context`: The context of the calling activity or application.\n   - **Usage**:\n     ```kotlin\n     interstitialAdManager.loadInterstitialAd(context)\n     ```\n\n#### 2. `showInterstitialAd(context: Activity)`\n   - **Purpose**: Displays the interstitial ad if available, and shows a loading dialog while the ad is being prepared.\n   - **Parameters**:\n     - `context`: The activity context that will host the ad.\n   - **Usage**:\n     ```kotlin\n     interstitialAdManager.showInterstitialAd(this)\n     ```\n\n#### 3. `adCapping()`\n   - **Purpose**: Ensures that the ad is only shown after a defined time gap (capping) to prevent showing too many ads in a short period.\n   - **Usage**: This function is used internally to check if the minimum time between ads has passed.\n\n#### 4. `isNetworkAvailable(context: Context)`\n   - **Purpose**: Checks if the device has an active network connection.\n   - **Parameters**:\n     - `context`: The context to get the system’s network service.\n   - **Usage**:\n     ```kotlin\n     interstitialAdManager.isNetworkAvailable(context)\n     ```\n\n---\n\n## Usage Example\n\n### Initialize and Load Ad\n\nBefore showing an ad, you need to load it. You can load the ad by calling the `loadInterstitialAd()` function.\n\n```kotlin\nval interstitialAdManager = InterstitialAdManager()\ninterstitialAdManager.loadInterstitialAd(context)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumairoye%2Finterstitialadmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumairoye%2Finterstitialadmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumairoye%2Finterstitialadmanager/lists"}