{"id":24669081,"url":"https://github.com/umairoye/applovin-ads","last_synced_at":"2025-03-21T13:25:49.433Z","repository":{"id":200970391,"uuid":"706672670","full_name":"UmairOye/Applovin-Ads","owner":"UmairOye","description":"This project implements various types of ads provided by Applovin, including Interstitial Ads, Native Manual Ads, Native Ad Placement, Native Templates, Banner Ads, App Open Ads and Reward Ads. It also features day and night modes for a more versatile user experience.","archived":false,"fork":false,"pushed_at":"2023-10-31T05:11:54.000Z","size":10095,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T09:19:07.209Z","etag":null,"topics":["applovin","applovin-max","bannerads","interstitial-ads","nativeads","openapp","rewardad"],"latest_commit_sha":null,"homepage":"https://github.com/UmairOye/Applovin-Ads/releases/download/release/app-debug.apk","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}},"created_at":"2023-10-18T12:08:31.000Z","updated_at":"2024-12-19T14:06:31.000Z","dependencies_parsed_at":"2023-10-31T06:24:06.891Z","dependency_job_id":null,"html_url":"https://github.com/UmairOye/Applovin-Ads","commit_stats":null,"previous_names":["umairoye/applovin-ads"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmairOye%2FApplovin-Ads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmairOye%2FApplovin-Ads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmairOye%2FApplovin-Ads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmairOye%2FApplovin-Ads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UmairOye","download_url":"https://codeload.github.com/UmairOye/Applovin-Ads/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244804844,"owners_count":20513188,"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":["applovin","applovin-max","bannerads","interstitial-ads","nativeads","openapp","rewardad"],"created_at":"2025-01-26T09:19:11.352Z","updated_at":"2025-03-21T13:25:49.412Z","avatar_url":"https://github.com/UmairOye.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Applovin-Ads\n\n## Description\n\nThis project implements various types of ads provided by Applovin, including:\n\n- Interstitial Ads\n- Native Manual Ads\n- Native Ad Placement\n- Native Templates\n- Banner Ads\n- App Open Ads\n- Reward Ads\n\nIt also features day and night modes for a more versatile user experience.\n\n## Screenshots\n\n\u003cimg width=\"200\" height=\"400\" src=\"screenshots/Screenshot_20231018-132058.png\" alt=\"Image\" \u003e  \u003cimg width=\"200\" height=\"400\" src=\"screenshots/Screenshot_20231018-132109.png\" alt=\"Image\" \u003e  \u003cimg width=\"200\" height=\"400\" src=\"screenshots/Screenshot_20231018-132122.png\" alt=\"Image\" \u003e  \u003cimg width=\"200\" height=\"400\" src=\"screenshots/Screenshot_20231018-132131.png\" alt=\"Image\" \u003e  \u003cimg width=\"200\" height=\"400\" src=\"screenshots/Screenshot_20231018-132136.png\" alt=\"Image\" \u003e  \u003cimg width=\"200\" height=\"400\" src=\"screenshots/Screenshot_20231018-132146.png\" alt=\"Image\" \u003e  \u003cimg width=\"200\" height=\"400\" src=\"screenshots/Screenshot_20231018-132156.png\" alt=\"Image\" \u003e\n\n## Features\n\n- Interstitial Ads: Full-screen ads that appear at natural transition points in your app.\n- Native Manual Ads: Customizable native ads integrated manually for seamless user experience.\n- Native Ad Placement: Strategically placing native ads for optimal user engagement and visibility.\n- Native Templates: Pre-defined layouts for native ads to maintain consistent design across the app.\n- Banner Ads: Horizontal ads typically placed at the top or bottom of the screen.\n- App Open Ads: Ads are shown when the app is launched, providing immediate visibility to users.\n- Reward Ads: Users receive incentives, like in-app currency, for engaging with these ads.\n- Day/Night Modes: Toggle between light and dark themes for enhanced user comfort and accessibility.\n\n## Usage\nExplain how to integrate and use the different ad types in your app. Provide code snippets, steps, or any other relevant information.\n1. Interstitial Ads\n```bash\n    private var interstitialAd: MaxInterstitialAd? = null\ninterstitialAd = MaxInterstitialAd(activity.getString(R.string.applovinInterstitial), activity)\n        requestNewInterstitial(interstitialAd!!)\n        if (interstitialAd!!.isReady) {\n            interstitialAd!!.showAd()\n            interstitialAd!!.setListener(object : MaxAdViewAdListener {\n                override fun onAdExpanded(ad: MaxAd) {}\n                override fun onAdCollapsed(ad: MaxAd) {\n                    Log.d(TAG, \"onAdCollapsed: \")\n\n                }\n\n                override fun onAdLoaded(ad: MaxAd) {\n                    Log.d(TAG, \"onAdLoaded: \")\n                }\n\n                override fun onAdDisplayed(ad: MaxAd) {}\n                override fun onAdHidden(ad: MaxAd) {\n                    requestNewInterstitial(interstitialAd!!)\n                    Log.d(TAG, \"onAdHidden: \")\n\n                }\n\n                override fun onAdClicked(ad: MaxAd) {}\n                override fun onAdLoadFailed(adUnitId: String, error: MaxError) {\n                    requestNewInterstitial(interstitialAd!!)\n                    Log.d(TAG, \"onAdLoadFailed: \")\n                }\n\n                override fun onAdDisplayFailed(ad: MaxAd, error: MaxError) {\n                    requestNewInterstitial(interstitialAd!!)\n                    Log.d(TAG, \"onAdDisplayFailed: \")\n                }\n            })\n        }\n```\n2. Native Manual Ads\n```bash\n  private fun createNativeAdView(\n        context: Activity,\n        nativeAdLayout: FrameLayout\n    ): MaxNativeAdLoader {\n\n        val binder: MaxNativeAdViewBinder =\n            MaxNativeAdViewBinder.Builder(R.layout.manual_native_view)\n                .setTitleTextViewId(R.id.title_text_view)\n                .setBodyTextViewId(R.id.body_text_view)\n                .setAdvertiserTextViewId(R.id.advertiser_text_view)\n                .setIconImageViewId(R.id.icon_image_view)\n                .setMediaContentViewGroupId(R.id.media_view_container)\n                .setOptionsContentViewGroupId(R.id.options_view)\n                .setStarRatingContentViewGroupId(R.id.star_rating_view)\n                .setCallToActionButtonId(R.id.cta_button)\n                .build()\n        nativeAdView = MaxNativeAdView(binder, context)\n        nativeAdLoader =\n            MaxNativeAdLoader(context.getString(R.string.applovinNativeManual), context)\n\n        nativeAdLoader!!.setNativeAdListener(object : MaxNativeAdListener() {\n            override fun onNativeAdLoaded(nativeAdView: MaxNativeAdView?, ad: MaxAd) {\n                if (nativeAd != null) {\n                    Log.d(TAG, \"ifNativeAdIsNotNull: \")\n                    nativeAdLoader!!.destroy(nativeAd)\n                }\n\n                nativeAd = ad\n                nativeAdLayout.removeAllViews()\n                nativeAdLayout.addView(nativeAdView)\n            }\n\n            override fun onNativeAdLoadFailed(adUnitId: String, error: MaxError) {\n            }\n\n            override fun onNativeAdClicked(ad: MaxAd) {\n\n            }\n\n            override fun onNativeAdExpired(ad: MaxAd) {\n            }\n\n        })\n        return nativeAdLoader as MaxNativeAdLoader\n    }\n```\n3. Native Ad Place\n```bash\n  val settings = MaxAdPlacerSettings(getString(R.string.applovinNativeSmall))\n        settings.addFixedPosition(2)\n        settings.addFixedPosition(5)\n        settings.repeatingInterval = 5\n\n        adapter = AdPlacerAdapter(adPlacerList)\n        adAdapter = MaxRecyclerAdapter(settings, adapter, requireActivity())\n\n        adAdapter.setListener(object : MaxAdPlacer.Listener {\n            override fun onAdLoaded(position: Int) {\n            }\n\n            override fun onAdRemoved(position: Int) {\n            }\n\n            override fun onAdClicked(ad: MaxAd?) {\n            }\n\n            override fun onAdRevenuePaid(ad: MaxAd?) {}\n        })\n\n        binding.recyclerView.adapter = adAdapter\n        binding.recyclerView.setHasFixedSize(true)\n        adAdapter.loadAds()\n```\n4. Native Templates Ad\n```bash\n    private fun showNativeTemplate(context: Activity, nativeAdContainer: FrameLayout) {\n        nativeAdLoader =\n            MaxNativeAdLoader(context.getString(R.string.applovinNativeMedium), context)\n        nativeAdLoader!!.setNativeAdListener(object : MaxNativeAdListener() {\n\n            override fun onNativeAdLoaded(nativeAdView: MaxNativeAdView?, ad: MaxAd) {\n                if (nativeAd != null) {\n                    nativeAdLoader!!.destroy(nativeAd)\n                }\n\n                nativeAd = ad\n\n                // Add ad view to view.\n                nativeAdContainer.removeAllViews()\n                nativeAdContainer.addView(nativeAdView)\n            }\n\n            override fun onNativeAdLoadFailed(adUnitId: String, error: MaxError) {\n            }\n\n            override fun onNativeAdClicked(ad: MaxAd) {\n            }\n        })\n        nativeAdLoader!!.loadAd()\n    }\n\n```\n5. Banner Ad\n```bash\n    override fun createBannerAd(context: Activity, banner: FrameLayout) {\n        adView = MaxAdView(context.getString(R.string.applovinBanner), context)\n\n        /*if you want to set background color.\n            adView?.setBackgroundColor(...)\n         */\n        banner.addView(adView)\n        adView!!.loadAd()\n        adView!!.startAutoRefresh()\n        adView!!.setListener(object : MaxAdViewAdListener {\n            override fun onAdLoaded(p0: MaxAd?) {\n                Log.d(TAG, \"onAdLoaded: Banner\")\n            }\n\n            override fun onAdDisplayed(p0: MaxAd?) {\n                Log.d(TAG, \"onAdDisplayed: Banner\")\n            }\n\n            override fun onAdHidden(p0: MaxAd?) {\n                Log.d(TAG, \"onAdHidden: Banner\")\n            }\n\n            override fun onAdClicked(p0: MaxAd?) {\n                Log.d(TAG, \"onAdClicked: Banner\")\n            }\n\n            override fun onAdLoadFailed(p0: String?, p1: MaxError?) {\n                Log.d(TAG, \"onAdLoadFailed: Banner ${p1!!.message}\")\n            }\n\n            override fun onAdDisplayFailed(p0: MaxAd?, p1: MaxError?) {\n                Log.d(TAG, \"onAdDisplayFailed: Banner ${p1!!.message}\")\n            }\n\n            override fun onAdExpanded(p0: MaxAd?) {\n                Log.d(TAG, \"onAdExpanded: Banner\")\n            }\n\n            override fun onAdCollapsed(p0: MaxAd?) {\n                Log.d(TAG, \"onAdCollapsed: Banner\")\n            }\n\n        })\n    }\n```\n6. App Open Ad\n```bash\nclass AppOpenManager(applicationContext: Context) : LifecycleObserver, MaxAdListener {\n    private var appOpenAd: MaxAppOpenAd\n    private var context = applicationContext\n\n\n    init {\n        ProcessLifecycleOwner.get().lifecycle.addObserver(this)\n        context.let {\n            appOpenAd = MaxAppOpenAd(context.getString(R.string.applovinOpen), it)\n            appOpenAd.setListener(this)\n            appOpenAd.loadAd()\n        }\n    }\n\n    fun showAdIfReady() {\n        if (!AppLovinSdk.getInstance(context).isInitialized) return\n        appOpenAd?.let {\n            if (appOpenAd.isReady) {\n                appOpenAd.showAd()\n            } else {\n                appOpenAd.loadAd()\n            }\n        }\n    }\n\n    @OnLifecycleEvent(Lifecycle.Event.ON_START)\n    fun onStart() {\n        showAdIfReady()\n    }\n\n    override fun onAdLoaded(ad: MaxAd) {\n    }\n\n    override fun onAdLoadFailed(adUnitId: String, error: MaxError) {\n        appOpenAd.loadAd()\n    }\n\n    override fun onAdDisplayed(ad: MaxAd) {\n        appOpenAd.loadAd()\n    }\n\n    override fun onAdClicked(ad: MaxAd) {}\n\n    override fun onAdHidden(ad: MaxAd) {\n        appOpenAd.loadAd()\n    }\n\n    override fun onAdDisplayFailed(ad: MaxAd, error: MaxError) {\n        appOpenAd.loadAd()\n    }\n\n}\n```\n7. Reward Ad\n```bash\nclass RewardedAds(private val context: Activity) : MaxRewardedAdListener {\n    private lateinit var rewardedAd: MaxRewardedAd\n    private var retryAttempt = 0.0\n\n\n    fun createRewardedAd() {\n        rewardedAd = MaxRewardedAd.getInstance(context.getString(R.string.applovinReward), context)\n        rewardedAd.setListener(this)\n        rewardedAd.loadAd()\n        if (rewardedAd.isReady) {\n            rewardedAd.showAd()\n        } else {\n            Toast.makeText(\n                context,\n                context.getString(R.string.reward_ad_is_not_ready_yet), Toast.LENGTH_SHORT\n            ).show()\n        }\n    }\n\n    override fun onAdLoaded(maxAd: MaxAd) {\n        retryAttempt = 0.0\n    }\n\n    override fun onAdLoadFailed(adUnitId: String?, error: MaxError?) {\n        Toast.makeText(context, error!!.message.toString(), Toast.LENGTH_SHORT).show()\n        retryAttempt++\n        rewardedAd.loadAd()\n    }\n\n    override fun onAdDisplayFailed(ad: MaxAd?, error: MaxError?) {\n        rewardedAd.loadAd()\n    }\n\n    override fun onAdDisplayed(maxAd: MaxAd) {}\n\n    override fun onAdClicked(maxAd: MaxAd) {}\n\n    override fun onAdHidden(maxAd: MaxAd) {\n        rewardedAd.loadAd()\n    }\n\n    override fun onRewardedVideoStarted(maxAd: MaxAd) {}\n\n    override fun onRewardedVideoCompleted(maxAd: MaxAd) {\n\n    }\n\n    override fun onUserRewarded(maxAd: MaxAd, maxReward: MaxReward) {\n\n    }\n}\n```\n\n## Installation\n```bash\nClone the repository and run the app in your IDE:\n```\n[Clone repository to run app](https://github.com/UmairOye/Applovin-Ads.git) \n```bash\nyou can download whole code as zip file:\n```\n[Click here to download code as zip](https://github.com/UmairOye/Applovin-Ads/archive/refs/heads/main.zip) \n```bash\nor download demo app for testing purpse:\n```\n[Download Demo App](https://github.com/UmairOye/Applovin-Ads/releases/download/release/app-debug.apk)\n\n## How to Contribute\nIf you would like to contribute to the project, follow these steps:\n\n\n\n1. Fork the repository\n2. Create a new branch (`git checkout -b feature/your-feature`)\n3. Make your changes and commit them (`git commit -m 'Add some feature'`)\n4. Push to the branch (`git push origin feature/your-feature`)\n5. Create a pull request\n\n## Don't Forget to Star ⭐\n\nIf you found this project useful or had fun exploring it, please consider giving it a star. It's a great way to show your appreciation and it puts a smile on my face! 😊🌟\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumairoye%2Fapplovin-ads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumairoye%2Fapplovin-ads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumairoye%2Fapplovin-ads/lists"}