{"id":25936869,"url":"https://github.com/chartboost/android-sdk-sample-java","last_synced_at":"2025-07-20T06:04:24.109Z","repository":{"id":41970690,"uuid":"231595983","full_name":"ChartBoost/android-sdk-sample-java","owner":"ChartBoost","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-24T14:39:46.000Z","size":515,"stargazers_count":11,"open_issues_count":8,"forks_count":8,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-06T18:14:23.260Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/ChartBoost.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}},"created_at":"2020-01-03T13:37:16.000Z","updated_at":"2025-01-28T02:24:34.000Z","dependencies_parsed_at":"2023-10-16T22:01:07.163Z","dependency_job_id":"56f3e54c-111b-4b4d-9113-3d2284389dd6","html_url":"https://github.com/ChartBoost/android-sdk-sample-java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ChartBoost/android-sdk-sample-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fandroid-sdk-sample-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fandroid-sdk-sample-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fandroid-sdk-sample-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fandroid-sdk-sample-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChartBoost","download_url":"https://codeload.github.com/ChartBoost/android-sdk-sample-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fandroid-sdk-sample-java/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266076036,"owners_count":23872729,"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":[],"created_at":"2025-03-04T02:54:56.829Z","updated_at":"2025-07-20T06:04:24.084Z","avatar_url":"https://github.com/ChartBoost.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# android-sdk-sample-java\nExample application which implementes Chartboost SDK to show basic use cases. It will guide user through initialisation of the SDK, caching and showing 3 types of different ads.\n\n## Chartboost SDK\n\nSign up for an account at [https://www.chartboost.com/](https://www.chartboost.com/) to receive your app id.\nFor more information go to [https://answers.chartboost.com/en-us/child_article/android](https://answers.chartboost.com/en-us/child_article/android)\n\n## Download\n\nChartboost SDK is available as an AAR via Maven Central; to use it, add the following to your `build.gradle`.\n\n```\nrepositories {\n    mavenCentral()\n    maven {\n        url 'https://cboost.jfrog.io/artifactory/chartboost-ads/'\n    }\n}\n\ndependencies {\n    implementation 'com.chartboost:chartboost-sdk:9.6.0'\n}\n```\n\n## General information\n\nTo display basic ads with Chartboost SDK, user needs to initialise the SDK before trying to launch the ad.\n\nSDK provides API calls where some are required and others could be optional.\n\n```\nChartboost.addDataUseConsent(this, new GDPR(GDPR.GDPR_CONSENT.BEHAVIORAL));\nChartboost.addDataUseConsent(this, new CCPA(CCPA.CCPA_CONSENT.OPT_IN_SALE));\nChartboost.addDataUseConsent(this, new COPPA(true));\n```\n*OPTIONAL: GDPR Compliance method with which you can limit our SDK's data collection. Call this method *before* calling Chartboost.startWithAppId() to ensure that our SDK, as well as dependencies such as Moat, will be restricted.\n\n```\nChartboost.startWithAppId(getApplicationContext(), DEFAULT_ID, DEFAULT_SIGNATURE, startError -\u003e {\n            if (startError == null) {\n              // handle success\n            } else {\n              // handle failure\n            }\n        });\n```\n*REQUIRED: Start Chartboost with required appId, appSignature and delegate.This method must be executed before any other Chartboost SDK methods can be used. Once executed this call will also control session tracking and background tasks used by Chartboost.\n\n\n```\nChartboost.setLoggingLevel(LoggingLevel.ALL);\n```\n*OPTIONAL: Set the Chartboost SDK logging level. Default is Level.INTEGRATION\n\n## Cache Interstitial\n```\nInterstitial chartboostInterstitial = new Interstitial(\"location\", new InterstitialCallback() {\n    @Override\n    public void onAdDismiss(@NonNull DismissEvent dismissEvent) {\n\n    }\n\n    @Override\n    public void onAdLoaded(@NonNull CacheEvent cacheEvent, @Nullable CacheError cacheError) {\n\n    }\n\n    @Override\n    public void onAdRequestedToShow(@NonNull ShowEvent showEvent) {\n\n    }\n\n    @Override\n    public void onAdShown(@NonNull ShowEvent showEvent, @Nullable ShowError showError) {\n\n    }\n\n    @Override\n    public void onAdClicked(@NonNull ClickEvent clickEvent, @Nullable ClickError clickError) {\n\n    }\n\n    @Override\n    public void onImpressionRecorded(@NonNull ImpressionEvent impressionEvent) {\n\n    }\n}, mediation);\nchartboostInterstitial.cache();\n\n```\nCreate and cache an interstitial ad object.\n\n\n## Show Interstitial\n```\nchartboostInterstitial.show();\n\n```\nShow an interstitial ad object.\n\n## Cache Rewarded video\n```\nRewarded chartboostRewarded = new Rewarded(\"start\", new RewardedCallback() {\n    @Override\n    public void onRewardEarned(@NonNull RewardEvent rewardEvent) {\n\n    }\n\n    @Override\n    public void onAdDismiss(@NonNull DismissEvent dismissEvent) {\n\n    }\n\n    @Override\n    public void onAdLoaded(@NonNull CacheEvent cacheEvent, @Nullable CacheError cacheError) {\n\n    }\n\n    @Override\n    public void onAdRequestedToShow(@NonNull ShowEvent showEvent) {\n\n    }\n\n    @Override\n    public void onAdShown(@NonNull ShowEvent showEvent, @Nullable ShowError showError) {\n\n    }\n\n    @Override\n    public void onAdClicked(@NonNull ClickEvent clickEvent, @Nullable ClickError clickError) {\n\n    }\n\n    @Override\n    public void onImpressionRecorded(@NonNull ImpressionEvent impressionEvent) {\n\n    }\n}, mediation);\nchartboostRewarded.cache();\n\n```\nCreate and cache rewarded ad object.\n\n\n## Show Rewarded video\n```\nchartboostRewarded.show();\n\n```\nShow a rewarded ad object.\n\n## Banners\nTo create new banner it is possible to do it in the xml layout file.\n```\nBanner chartboostBanner = new Banner(this, \"start\", Banner.BannerSize.STANDARD, new BannerCallback() {\n    @Override\n    public void onAdLoaded(@NonNull CacheEvent cacheEvent, @Nullable CacheError cacheError) {\n\n    }\n\n    @Override\n    public void onAdRequestedToShow(@NonNull ShowEvent showEvent) {\n\n    }\n\n    @Override\n    public void onAdShown(@NonNull ShowEvent showEvent, @Nullable ShowError showError) {\n\n    }\n\n    @Override\n    public void onAdClicked(@NonNull ClickEvent clickEvent, @Nullable ClickError clickError) {\n\n    }\n\n    @Override\n    public void onImpressionRecorded(@NonNull ImpressionEvent impressionEvent) {\n\n    }\n}, mediation);\n\n```\n\n\nto cache the ad\n```\nchartboostBanner.cache();\n\n```\n\nand show to make the ad visible\n```\nchartboostBanner.show();\n\n```\n\nand at the end of the activity lifecycle developer should detach Banner from the view and destroy the object. In order to do so, use:\n```\nchartboostBanner.detachBanner();\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchartboost%2Fandroid-sdk-sample-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchartboost%2Fandroid-sdk-sample-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchartboost%2Fandroid-sdk-sample-java/lists"}