├── .github
└── workflows
│ ├── uitests.yaml
│ └── uitests_saucelabs.yaml
├── .gitignore
├── README.md
├── analytics
├── .gitignore
├── build.gradle
├── google-services.json
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── appodealstack
│ │ └── demo
│ │ └── analytics
│ │ ├── AnalyticsActivity.kt
│ │ ├── AnalyticsViewModel.kt
│ │ └── BillingUseCase.kt
│ └── res
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ └── activity_analytics.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-mdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── themes.xml
│ └── xml
│ └── network_security_config.xml
├── banner
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── appodealstack
│ │ └── demo
│ │ └── banner
│ │ └── BannerActivity.kt
│ └── res
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ └── activity_banner.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-mdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── values
│ ├── strings.xml
│ └── themes.xml
│ └── xml
│ └── network_security_config.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── interstitial
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── appodealstack
│ │ └── demo
│ │ └── interstitial
│ │ └── InterstitialActivity.kt
│ └── res
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ └── activity_interstitial.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-mdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── values
│ ├── strings.xml
│ └── themes.xml
│ └── xml
│ └── network_security_config.xml
├── mrec
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── appodealstack
│ │ └── demo
│ │ └── mrec
│ │ └── MrecActivity.kt
│ └── res
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ └── activity_mrec.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-mdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── values
│ ├── strings.xml
│ └── themes.xml
│ └── xml
│ └── network_security_config.xml
├── native
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── appodealstack
│ │ └── demo
│ │ └── nativead
│ │ ├── NativeActivity.kt
│ │ ├── NativeListFragment.kt
│ │ └── adapter
│ │ ├── DiffUtils.kt
│ │ ├── ListItem.kt
│ │ └── NativeListAdapter.kt
│ └── res
│ ├── drawable
│ ├── ic_launcher_background.xml
│ └── native_custom_round_outline.xml
│ ├── layout
│ ├── activity_native.xml
│ ├── native_ad_view_custom.xml
│ ├── native_list_fragment.xml
│ └── your_data_item.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-mdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── themes.xml
│ └── xml
│ └── network_security_config.xml
├── rewarded
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── appodealstack
│ │ └── demo
│ │ └── rewarded
│ │ └── RewardedActivity.kt
│ └── res
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ └── activity_rewarded.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-mdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.webp
│ └── ic_launcher_round.webp
│ ├── values
│ ├── strings.xml
│ └── themes.xml
│ └── xml
│ └── network_security_config.xml
└── settings.gradle
/.github/workflows/uitests.yaml:
--------------------------------------------------------------------------------
1 | name: UITest
2 |
3 | on:
4 | workflow_dispatch:
5 | inputs:
6 | device:
7 | required: true
8 | default: 'Pixel8_API33'
9 | type: choice
10 | options:
11 | - 'Pixel8_API33'
12 | - 'Pixel8_API35'
13 | runner:
14 | required: true
15 | default: 'autotestdebug'
16 | type: choice
17 | options:
18 | - 'autotestdebug'
19 | - 'ubuntu-latest'
20 |
21 | jobs:
22 | build:
23 | name: build android application for ui tests
24 | runs-on: ${{ github.event.inputs.runner || 'autotestdebug' }}
25 | timeout-minutes: 30
26 | steps:
27 | - name: Print Env Variables
28 | run: env
29 | working-directory: ${{ github.workspace }}
30 |
31 | - name: checkout source code of application
32 | uses: actions/checkout@v4
33 | with:
34 | clean: true
35 | path: 'appodeal-android-sdk'
36 |
37 | - name: Set up JDK 17
38 | uses: actions/setup-java@v4
39 | with:
40 | java-version: '17'
41 | distribution: 'temurin'
42 |
43 | - name: Build with Gradle
44 | working-directory: ${{ github.workspace }}/appodeal-android-sdk
45 | run: ./gradlew :banner:assembleDebug
46 |
47 | - name: save debug build for aws
48 | uses: actions/upload-artifact@v4
49 | with:
50 | name: banner-debug.apk
51 | path: appodeal-android-sdk/banner/build/outputs/apk/debug/banner-debug.apk
52 | retention-days: 14
53 |
54 | tests:
55 | name: run ui tests on aws with appium
56 | needs: build
57 | runs-on: ${{ github.event.inputs.runner || 'autotestdebug' }}
58 | timeout-minutes: 30
59 | steps:
60 | - name: Print Env Variables
61 | run: env
62 | working-directory: ${{ github.workspace }}
63 |
64 | - name: checkout source code of application
65 | uses: actions/checkout@v4
66 | with:
67 | path: 'SDK-Auto-Test'
68 | clean: true
69 | repository: 'appodeal/SDK-Auto-Test'
70 | ref: 'aws'
71 | token: ${{ secrets.UITESTREPOACCESS }}
72 |
73 | - name: Set up JDK 11
74 | uses: actions/setup-java@v4
75 | with:
76 | java-version: '11'
77 | distribution: 'temurin'
78 |
79 | - name: download debug build
80 | uses: actions/download-artifact@v4
81 | with:
82 | name: banner-debug.apk
83 | path: ./SDK-Auto-Test/apk
84 |
85 | - name: prepare build
86 | working-directory: ${{ github.workspace }}/SDK-Auto-Test
87 | run: |
88 | mvn clean
89 | sleep 10
90 | mvn jar:jar
91 | sleep 10
92 | mvn jar:test-jar
93 | sleep 10
94 | mvn assembly:assembly -DskipTests -Ddescriptor=src/main/assembly/zip.xml
95 |
96 | - name: Configure AWS credentials
97 | uses: aws-actions/configure-aws-credentials@v4
98 | with:
99 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
100 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
101 | aws-region: us-west-2
102 |
103 | - name: Upload APK to AWS Device Farm
104 | id: upload-apk
105 | run: |
106 | APP_UPLOAD_RESPONSE=$(aws devicefarm create-upload --project-arn arn:aws:devicefarm:us-west-2:381491970378:project:4c28c1e5-8344-4d34-919c-a1e9377d3b2f --name banner-debug.apk --type ANDROID_APP)
107 | APP_ARN=$(echo $APP_UPLOAD_RESPONSE | jq -r .upload.arn)
108 | echo "APP_ARN=$APP_ARN" >> $GITHUB_ENV
109 | APP_URL=$(echo $APP_UPLOAD_RESPONSE | jq -r .upload.url)
110 | curl -T ./SDK-Auto-Test/apk/banner-debug.apk "$APP_URL"
111 | # Wait until the upload is processed
112 | while [[ "$(aws devicefarm get-upload --arn $APP_ARN | jq -r '.upload.status')" != "SUCCEEDED" ]]; do
113 | echo "Waiting for APK upload to complete..."
114 | sleep 10
115 | done
116 |
117 | - name: Upload Test Package to AWS Device Farm
118 | id: upload-tests
119 | run: |
120 | TEST_PACKAGE_UPLOAD_RESPONSE=$(aws devicefarm create-upload --project-arn arn:aws:devicefarm:us-west-2:381491970378:project:4c28c1e5-8344-4d34-919c-a1e9377d3b2f --name zip-with-dependencies.zip --type APPIUM_JAVA_TESTNG_TEST_PACKAGE)
121 | TEST_PACKAGE_ARN=$(echo $TEST_PACKAGE_UPLOAD_RESPONSE | jq -r .upload.arn)
122 | echo "TEST_PACKAGE_ARN=$TEST_PACKAGE_ARN" >> $GITHUB_ENV
123 | TEST_PACKAGE_URL=$(echo $TEST_PACKAGE_UPLOAD_RESPONSE | jq -r .upload.url)
124 | curl -T ./SDK-Auto-Test/target/zip-with-dependencies.zip $TEST_PACKAGE_URL
125 | # Wait until the upload is processed
126 | while [[ "$(aws devicefarm get-upload --arn $TEST_PACKAGE_ARN | jq -r '.upload.status')" != "SUCCEEDED" ]]; do
127 | echo "Waiting for Test Package upload to complete..."
128 | sleep 10
129 | done
130 |
131 | - name: Schedule Device Farm Automated Test
132 | id: run-test
133 | uses: aws-actions/aws-devicefarm-mobile-device-testing@v2.3
134 | with:
135 | run-settings-json: |
136 | {
137 | "name": "GitHubAction-${{ github.workflow }}_${{ github.run_id }}_${{ github.run_attempt }}",
138 | "projectArn": "arn:aws:devicefarm:us-west-2:381491970378:project:4c28c1e5-8344-4d34-919c-a1e9377d3b2f",
139 | "appArn": "${{ env.APP_ARN }}",
140 | "devicePoolArn": "arn:aws:devicefarm:us-west-2:381491970378:devicepool:4c28c1e5-8344-4d34-919c-a1e9377d3b2f/86ebd86a-2150-4997-b71f-2e3d72510e0d",
141 | "test": {
142 | "type": "APPIUM_JAVA_TESTNG",
143 | "testPackageArn": "${{ env.TEST_PACKAGE_ARN }}",
144 | "testSpecArn": "default.yml"
145 | }
146 | }
147 | artifact-types: ALL
148 |
149 | - uses: actions/upload-artifact@v4
150 | if: always()
151 | with:
152 | name: AutomatedTestOutputFiles
153 | path: ${{ steps.run-test.outputs.artifact-folder }}
154 |
155 | - name: Adding summary
156 | if: ${{ always() }}
157 | run: |
158 | echo "### Results of test execution :fire:" >> $GITHUB_STEP_SUMMARY
159 | echo "Launch: ${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
160 | echo "Device: ${{ github.event.inputs.device }}" >> $GITHUB_STEP_SUMMARY
161 | echo "Build agent: ${{ github.event.inputs.runner }}" >> $GITHUB_STEP_SUMMARY
162 |
163 | report:
164 | name: send test report to slack
165 | needs: tests
166 | runs-on: ${{ github.event.inputs.runner || 'autotestdebug' }}
167 | timeout-minutes: 10
168 | steps:
169 | - name: Print Env Variables
170 | run: env
171 | working-directory: ${{ github.workspace }}
172 |
173 | - name: checkout source code of application
174 | uses: actions/checkout@v4
175 | with:
176 | path: 'SDK-Auto-Test'
177 | clean: true
178 | repository: 'appodeal/SDK-Auto-Test'
179 | ref: 'aws'
180 | token: ${{ secrets.UITESTREPOACCESS }}
181 |
182 | - name: Set up JDK 11
183 | uses: actions/setup-java@v4
184 | with:
185 | java-version: '11'
186 | distribution: 'temurin'
187 |
188 | - name: download debug build
189 | uses: actions/download-artifact@v4
190 | with:
191 | name: AutomatedTestOutputFiles
192 | path: ./SDK-Auto-Test/
193 |
194 | - name: Copy Junit Reports
195 | if: always()
196 | working-directory: ${{ github.workspace }}/SDK-Auto-Test
197 | env:
198 | DEVICEFARM_LOG_DIR: \$DEVICEFARM_LOG_DIR
199 | run: |
200 | rm -rf saved_reports && mkdir saved_reports
201 | find . -type f -name "00003-Customer Artifacts.zip" | while read -r file; do
202 | unzip "$file" -d "$(dirname "$file")"
203 | test_file_path=$(find "$(dirname "$file")" -type f -name "TEST-tests.example_APD.ApdBannerTest.xml")
204 | if [ -n "$test_file_path" ]; then
205 | echo "Файл найден: $test_file_path"
206 | removed_spaces=$(echo "$test_file_path" | tr -d ' ')
207 | first_directory=$(echo "$removed_spaces" | cut -d'/' -f2)
208 | cp "$test_file_path" ./saved_reports/$first_directory.xml
209 | fi
210 | done
211 |
212 | - name: Run JUnitReportParser for all XML files
213 | if: always()
214 | working-directory: ${{ github.workspace }}/SDK-Auto-Test
215 | run: |
216 | chmod +x slack.sh
217 | if [ -d "./saved_reports" ]; then
218 | find ./saved_reports -type f -name "*.xml" | while read -r test_file_path; do
219 | if [ -n "$test_file_path" ]; then
220 | echo "Файл найден: $test_file_path"
221 | ./slack.sh "$test_file_path" ${{ secrets.SLACK_WEBHOOK_URL }}
222 | fi
223 | done
224 | else
225 | echo "Directory ./saved_reports does not exist."
226 | fi
227 |
--------------------------------------------------------------------------------
/.github/workflows/uitests_saucelabs.yaml:
--------------------------------------------------------------------------------
1 | name: UITest on SauceLabs
2 |
3 | on:
4 | workflow_dispatch:
5 | inputs:
6 | device:
7 | required: true
8 | default: 'Pixel8_API33'
9 | type: choice
10 | options:
11 | - 'Pixel8_API33'
12 | - 'Pixel8_API35'
13 | runner:
14 | required: true
15 | default: 'autotestdebug'
16 | type: choice
17 | options:
18 | - 'autotestdebug'
19 | - 'ubuntu-latest'
20 |
21 | jobs:
22 | build:
23 | name: build android application for ui tests
24 | runs-on: ${{ github.event.inputs.runner || 'autotestdebug' }}
25 | timeout-minutes: 30
26 | steps:
27 | - name: Print Env Variables
28 | run: env
29 | working-directory: ${{ github.workspace }}
30 |
31 | - name: checkout source code of application
32 | uses: actions/checkout@v4
33 | with:
34 | clean: true
35 | path: 'appodeal-android-sdk'
36 |
37 | - name: Set up JDK 17
38 | uses: actions/setup-java@v4
39 | with:
40 | java-version: '17'
41 | distribution: 'temurin'
42 |
43 | - name: Build with Gradle
44 | working-directory: ${{ github.workspace }}/appodeal-android-sdk
45 | run: ./gradlew :banner:assembleDebug
46 |
47 | - name: save debug build for aws
48 | uses: actions/upload-artifact@v4
49 | with:
50 | name: banner-debug.apk
51 | path: appodeal-android-sdk/banner/build/outputs/apk/debug/banner-debug.apk
52 | retention-days: 14
53 |
54 | - name: Upload apk to SauceLabs
55 | run: |
56 | curl -u "${{ secrets.SAUCELABS_USERNAME }}:${{ secrets.SAUCELABS_ACCESS_KEY }}" --location \
57 | --request POST 'https://api.eu-central-1.saucelabs.com/v1/storage/upload' \
58 | --form 'payload=@"appodeal-android-sdk/banner/build/outputs/apk/debug/banner-debug.apk"' \
59 | --form 'name="banner-debug.apk"' \
60 | --form 'description="APD demo \n ${GITHUB_REF_NAME}"'
61 |
62 | # GITHUB_REF_NAME=feature/auto_test
63 | # GITHUB_RUN_ID=10653731636
64 | # GITHUB_REPOSITORY=appodeal/appodeal-android-sdk
65 | # https://github.com/appodeal/appodeal-android-sdk/actions/runs/10653731636
66 | # GITHUB_TRIGGERING_ACTOR=johnlitvinov
67 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | *.iml
4 | .idea/*
5 | .DS_Store
6 | build/
7 | captures/
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Appodeal Android SDK
2 |
3 | [](https://docs.appodeal.com/android/get-started)
4 |
5 | # Examples
6 |
7 | * [Banner](https://github.com/appodeal/appodeal-android-sdk/tree/master/banner)
8 | * [Interstitial](https://github.com/appodeal/appodeal-android-sdk/tree/master/interstitial)
9 | * [MREC](https://github.com/appodeal/appodeal-android-sdk/tree/master/mrec)
10 | * [Rewarded Video](https://github.com/appodeal/appodeal-android-sdk/tree/master/rewarded)
11 | * [Native](https://github.com/appodeal/appodeal-android-sdk/tree/master/native)
12 | * [Services](https://github.com/appodeal/appodeal-android-sdk/tree/master/analytics)
13 |
14 | # Documentation
15 |
16 | The examples show only the most commonly used methods. Check out
17 | our [Get started](https://docs.appodeal.com/android/get-started) page for documentation on using the
18 | Appodeal SDK.
19 |
20 | If you have any comments or suggestions about the Appodeal SDK, please contact our support team
21 | support@appodeal.com.
--------------------------------------------------------------------------------
/analytics/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/analytics/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'org.jetbrains.kotlin.android'
4 | id 'com.google.gms.google-services'
5 | }
6 |
7 | android {
8 | compileSdk 34
9 | namespace 'com.appodealstack.demo.analytics'
10 |
11 | defaultConfig {
12 | buildConfigField "String", "APP_KEY", "\"d908f77a97ae0993514bc8edba7e776a36593c77e5f44994\""
13 | applicationId "com.appodealstack.demo"
14 | minSdkVersion 21
15 | targetSdkVersion 34
16 | versionCode 1
17 | versionName "1.0"
18 | }
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_11
27 | targetCompatibility JavaVersion.VERSION_11
28 | }
29 | kotlinOptions {
30 | jvmTarget = '11'
31 | }
32 | buildFeatures {
33 | viewBinding true
34 | buildConfig true
35 | }
36 | }
37 |
38 | dependencies {
39 | implementation 'androidx.core:core-ktx:1.13.1'
40 | implementation 'androidx.activity:activity-ktx:1.9.1'
41 | implementation 'androidx.appcompat:appcompat:1.7.0'
42 | implementation 'com.google.android.material:material:1.12.0'
43 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
44 | // Google billing library for Appodeal purchase validation
45 | implementation 'com.android.billingclient:billing-ktx:7.0.0'
46 | // Appodeal SDK 3.6.0.0
47 | implementation 'com.appodeal.ads:sdk:3.6.0.0'
48 | }
--------------------------------------------------------------------------------
/analytics/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "785362040133",
4 | "firebase_url": "https://appodeal-sandbox.firebaseio.com",
5 | "project_id": "appodeal-sandbox",
6 | "storage_bucket": "appodeal-sandbox.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:785362040133:android:77aa069cb9b77f91c57a2c",
12 | "android_client_info": {
13 | "package_name": "com.appodealstack.demo"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "785362040133-9odke8a112ah3a9d2dbl9gd2lrpm809c.apps.googleusercontent.com",
19 | "client_type": 3
20 | }
21 | ],
22 | "api_key": [
23 | {
24 | "current_key": "AIzaSyBwlWE5mcH3RTbABRPp7_bSio1vzsQmjqY"
25 | }
26 | ],
27 | "services": {
28 | "appinvite_service": {
29 | "other_platform_oauth_client": [
30 | {
31 | "client_id": "785362040133-9odke8a112ah3a9d2dbl9gd2lrpm809c.apps.googleusercontent.com",
32 | "client_type": 3
33 | }
34 | ]
35 | }
36 | }
37 | }
38 | ],
39 | "configuration_version": "1"
40 | }
--------------------------------------------------------------------------------
/analytics/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 |
--------------------------------------------------------------------------------
/analytics/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
18 |
21 |
22 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
44 |
45 |
48 |
49 |
52 |
53 |
56 |
57 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/analytics/src/main/java/com/appodealstack/demo/analytics/AnalyticsActivity.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.analytics
2 |
3 | import android.content.Context
4 | import android.os.Bundle
5 | import android.util.Log
6 | import android.widget.Toast
7 | import androidx.activity.viewModels
8 | import androidx.appcompat.app.AppCompatActivity
9 | import com.android.billingclient.api.BillingClient
10 | import com.android.billingclient.api.Purchase
11 | import com.appodeal.ads.Appodeal
12 | import com.appodeal.ads.AppodealServices
13 | import com.appodeal.ads.inapp.InAppPurchase
14 | import com.appodeal.ads.inapp.InAppPurchaseValidateCallback
15 | import com.appodeal.ads.initializing.ApdInitializationError
16 | import com.appodeal.ads.revenue.AdRevenueCallbacks
17 | import com.appodeal.ads.revenue.RevenueInfo
18 | import com.appodeal.ads.service.ServiceError
19 | import com.appodeal.ads.utils.Log.LogLevel
20 | import com.appodealstack.demo.analytics.databinding.ActivityAnalyticsBinding
21 |
22 | class AnalyticsActivity : AppCompatActivity() {
23 |
24 | private val viewModel by viewModels()
25 |
26 | override fun onCreate(savedInstanceState: Bundle?) {
27 | super.onCreate(savedInstanceState)
28 | val binding = ActivityAnalyticsBinding.inflate(layoutInflater)
29 | setContentView(binding.root)
30 | setUpAppodealSdk(binding)
31 | }
32 |
33 | private fun setUpAppodealSdk(binding: ActivityAnalyticsBinding) {
34 | Appodeal.setLogLevel(LogLevel.verbose)
35 | Appodeal.initialize(
36 | this,
37 | BuildConfig.APP_KEY,
38 | Appodeal.NONE
39 | ) { errors: List? ->
40 | val initResult =
41 | if (errors.isNullOrEmpty()) "successfully" else "with ${errors.size} errors"
42 | showToast("Appodeal initialized $initResult")
43 | errors?.forEach {
44 | Log.e(TAG, "onInitializationFinished: ", it)
45 | }
46 | }
47 | Appodeal.setAdRevenueCallbacks(object : AdRevenueCallbacks {
48 | override fun onAdRevenueReceive(revenueInfo: RevenueInfo) {
49 | // Called whenever SDK receives revenue information for an ad
50 | }
51 | })
52 | with(binding) {
53 | validateInapp.setOnClickListener { viewModel.flowInAppPurchase(this@AnalyticsActivity) }
54 | validateSubscription.setOnClickListener { viewModel.flowSubsPurchase(this@AnalyticsActivity) }
55 | logEvent.setOnClickListener { logEvent() }
56 | }
57 | viewModel.purchases.observe(this) { purchases ->
58 | purchases.forEach { validatePurchase(it) }
59 | }
60 | }
61 |
62 | private fun logEvent() {
63 | val params = mapOf(
64 | "example_param_1" to "Param1 value",
65 | "example_param_2" to 123
66 | )
67 | Appodeal.logEvent(
68 | eventName = "appodealstack_sdk_example_test_event",
69 | params = params,
70 | service = AppodealServices.APPSFLYER or AppodealServices.FIREBASE
71 | )
72 | }
73 |
74 | private fun validatePurchase(purchase: Purchase) = purchase.products.forEach { productId ->
75 | val productDetails =
76 | viewModel.getProductDetails(productId) ?: error("Product details is null")
77 | val apdPurchaseBuilder = when (productDetails.productType) {
78 | BillingClient.ProductType.INAPP -> {
79 | InAppPurchase.newInAppBuilder().apply {
80 | productDetails.oneTimePurchaseOfferDetails?.let {
81 | withPrice(it.formattedPrice)
82 | withCurrency(it.priceCurrencyCode)
83 | }
84 | }
85 | }
86 |
87 | BillingClient.ProductType.SUBS -> {
88 | InAppPurchase.newSubscriptionBuilder().apply {
89 | productDetails.subscriptionOfferDetails?.let {
90 | val pricingPhase = it.first().pricingPhases.pricingPhaseList.first()
91 | withPrice(pricingPhase.formattedPrice)
92 | withCurrency(pricingPhase.priceCurrencyCode)
93 | }
94 | }
95 | }
96 |
97 | else -> error("Product type is incorrect")
98 | }
99 | val apdPurchase: InAppPurchase = apdPurchaseBuilder
100 | .withPublicKey(PUBLIC_KEY)
101 | .withSignature(purchase.signature)
102 | .withPurchaseData(purchase.originalJson)
103 | .withPurchaseToken(purchase.purchaseToken)
104 | .withPurchaseTimestamp(purchase.purchaseTime)
105 | .withDeveloperPayload(purchase.developerPayload)
106 | .withOrderId(purchase.orderId)
107 | .withSku(productId)
108 | .withAdditionalParams(mapOf("some_parameter" to "some_value"))
109 | .build()
110 |
111 | // Validate InApp purchase
112 | Appodeal.validateInAppPurchase(this, apdPurchase, object : InAppPurchaseValidateCallback {
113 | override fun onInAppPurchaseValidateSuccess(
114 | purchase: InAppPurchase,
115 | errors: List?
116 | ) {
117 | Log.v(TAG, "onInAppPurchaseValidateSuccess")
118 | errors?.forEach { error ->
119 | Log.e(TAG, "onInAppPurchaseValidateSuccess - $error")
120 | }
121 | }
122 |
123 | override fun onInAppPurchaseValidateFail(
124 | purchase: InAppPurchase,
125 | errors: List
126 | ) {
127 | Log.v(TAG, "onInAppPurchaseValidateFail")
128 | errors.forEach { error ->
129 | Log.e(TAG, "onInAppPurchaseValidateFail - $error")
130 | }
131 | }
132 | })
133 | }
134 | }
135 |
136 | private fun Context.showToast(message: String) =
137 | Toast.makeText(applicationContext, message, Toast.LENGTH_SHORT).show()
138 |
139 | /** https://support.google.com/googleplay/android-developer/answer/186113 */
140 | private const val PUBLIC_KEY = "YOUR_PUBLIC_KEY"
141 | private const val TAG = "AnalyticsActivity"
--------------------------------------------------------------------------------
/analytics/src/main/java/com/appodealstack/demo/analytics/AnalyticsViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.analytics
2 |
3 | import android.app.Activity
4 | import android.app.Application
5 | import androidx.lifecycle.AndroidViewModel
6 | import androidx.lifecycle.LiveData
7 | import com.android.billingclient.api.Purchase
8 |
9 | class AnalyticsViewModel(
10 | application: Application,
11 | ) : AndroidViewModel(application) {
12 |
13 | private val billing = BillingUseCase(application, ID_COINS, ID_INFINITE_ACCESS_MONTHLY)
14 | val purchases: LiveData> = billing.purchases
15 |
16 | fun flowInAppPurchase(activity: Activity) = billing.flowInApp(activity, ID_COINS)
17 |
18 | fun flowSubsPurchase(activity: Activity) =
19 | billing.flowSubscription(activity, ID_INFINITE_ACCESS_MONTHLY)
20 |
21 | fun getProductDetails(productId: String) = billing.productDetails[productId]
22 | }
23 |
24 | private const val ID_COINS = "coins"
25 | private const val ID_INFINITE_ACCESS_MONTHLY = "infinite_access_monthly"
26 |
--------------------------------------------------------------------------------
/analytics/src/main/java/com/appodealstack/demo/analytics/BillingUseCase.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.analytics
2 |
3 | import android.app.Activity
4 | import android.content.Context
5 | import android.util.Log
6 | import androidx.lifecycle.LiveData
7 | import androidx.lifecycle.MutableLiveData
8 | import com.android.billingclient.api.*
9 |
10 | class BillingUseCase(
11 | context: Context,
12 | private val inAppProductId: String,
13 | private val subsProductId: String
14 | ) {
15 | private val _productDetails = mutableMapOf()
16 | private val _purchases = MutableLiveData>()
17 |
18 | val productDetails: Map get() = _productDetails
19 | val purchases: LiveData> get() = _purchases
20 |
21 | private val purchasesUpdatedListener = PurchasesUpdatedListener { billingResult, purchases ->
22 | debug("onPurchasesUpdated: ${billingResult.responseCode} ${billingResult.debugMessage}")
23 | when (billingResult.responseCode) {
24 | BillingClient.BillingResponseCode.OK -> {
25 | purchases?.let {
26 | processPurchaseList(it)
27 | _purchases.postValue(it)
28 | } ?: error("onPurchasesUpdated: Null Purchase List Returned from OK response!")
29 | }
30 | BillingClient.BillingResponseCode.USER_CANCELED -> debug("onPurchasesUpdated: User canceled the purchase")
31 | BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED -> debug("onPurchasesUpdated: The user already owns this item")
32 | BillingClient.BillingResponseCode.DEVELOPER_ERROR -> error(
33 | "onPurchasesUpdated: Developer error means that Google Play " +
34 | "does not recognize the configuration. If you are just getting started, " +
35 | "make sure you have configured the application correctly in the " +
36 | "Google Play Console. The SKU product ID must match and the APK you " +
37 | "are using must be signed with release keys."
38 | )
39 | }
40 | }
41 |
42 | private val billingClientStateListener = object : BillingClientStateListener {
43 | override fun onBillingSetupFinished(billingResult: BillingResult) {
44 | debug("onBillingSetupFinished: ${billingResult.responseCode} ${billingResult.debugMessage}")
45 | if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
46 | // The billing client is ready. You can query purchases here.
47 | // This doesn't mean that your app is set up correctly in the console -- it just
48 | // means that you have a connection to the Billing service.
49 | queryProductDetailsAsync()
50 | refreshPurchasesAsync()
51 | }
52 | }
53 |
54 | override fun onBillingServiceDisconnected() {
55 | debug("onBillingServiceDisconnected")
56 | }
57 | }
58 |
59 | private val billingClient =
60 | BillingClient.newBuilder(context)
61 | .setListener(purchasesUpdatedListener)
62 | .enablePendingPurchases()
63 | .build()
64 | .apply { startConnection(billingClientStateListener) }
65 |
66 | fun flowInApp(activity: Activity, productId: String) {
67 | val productDetails: ProductDetails = _productDetails[productId] ?: return
68 | val productDetailsParams = BillingFlowParams.ProductDetailsParams.newBuilder()
69 | .setProductDetails(productDetails)
70 | .build()
71 | flow(activity, productDetailsParams)
72 | }
73 |
74 | fun flowSubscription(activity: Activity, productId: String) {
75 | val productDetails: ProductDetails = _productDetails[productId] ?: return
76 | val offerToken = productDetails.subscriptionOfferDetails?.last()?.offerToken ?: return
77 | val productDetailsParams = BillingFlowParams.ProductDetailsParams.newBuilder()
78 | .setProductDetails(productDetails)
79 | .setOfferToken(offerToken)
80 | .build()
81 | flow(activity, productDetailsParams)
82 | }
83 |
84 | private fun flow(
85 | activity: Activity,
86 | productDetailsParams: BillingFlowParams.ProductDetailsParams
87 | ) {
88 | val billingFlowParams = BillingFlowParams.newBuilder()
89 | .setProductDetailsParamsList(listOf(productDetailsParams))
90 | .build()
91 | val billingResult = billingClient.launchBillingFlow(activity, billingFlowParams)
92 | if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
93 | debug("Flow billing success")
94 | } else {
95 | error("Flow billing failed: ${billingResult.debugMessage}")
96 | }
97 | }
98 |
99 | private fun queryProductDetailsAsync() {
100 | val detailsResponseListener =
101 | ProductDetailsResponseListener { billingResult, productDetailsList ->
102 | debug("onProductDetailsResponse: ${billingResult.responseCode} ${billingResult.debugMessage}")
103 | if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
104 | if (productDetailsList.isEmpty()) {
105 | error(
106 | "onProductDetailsResponse: " +
107 | "Found null or empty SkuDetails. " +
108 | "Check to see if the SKUs you requested are correctly published " +
109 | "in the Google Play Console."
110 | )
111 | } else {
112 | for (productDetails: ProductDetails in productDetailsList) {
113 | _productDetails[productDetails.productId] = productDetails
114 | }
115 | }
116 | }
117 | }
118 | billingClient.queryProductDetailsAsync(
119 | QueryProductDetailsParams.newBuilder().setProductList(
120 | listOf(
121 | QueryProductDetailsParams.Product.newBuilder()
122 | .setProductType(BillingClient.ProductType.INAPP)
123 | .setProductId(inAppProductId)
124 | .build()
125 | )
126 | ).build(),
127 | detailsResponseListener
128 | )
129 | billingClient.queryProductDetailsAsync(
130 | QueryProductDetailsParams.newBuilder().setProductList(
131 | listOf(
132 | QueryProductDetailsParams.Product.newBuilder()
133 | .setProductType(BillingClient.ProductType.SUBS)
134 | .setProductId(subsProductId)
135 | .build()
136 | )
137 | ).build(),
138 | detailsResponseListener
139 | )
140 | debug("Query product details started.")
141 | }
142 |
143 | private fun refreshPurchasesAsync() {
144 | val purchasesResponseListener = PurchasesResponseListener { billingResult, purchaseList ->
145 | if (billingResult.responseCode != BillingClient.BillingResponseCode.OK) {
146 | error("Problem getting purchases: ${billingResult.debugMessage}")
147 | } else {
148 | processPurchaseList(purchaseList)
149 | }
150 | }
151 | billingClient.queryPurchasesAsync(
152 | QueryPurchasesParams
153 | .newBuilder()
154 | .setProductType(BillingClient.ProductType.INAPP)
155 | .build(),
156 | purchasesResponseListener
157 | )
158 | billingClient.queryPurchasesAsync(
159 | QueryPurchasesParams
160 | .newBuilder()
161 | .setProductType(BillingClient.ProductType.SUBS)
162 | .build(),
163 | purchasesResponseListener
164 | )
165 | debug("Refreshing purchases started.")
166 | }
167 |
168 | private fun processPurchaseList(purchases: List) {
169 | purchases
170 | .filter { purchase -> purchase.purchaseState == Purchase.PurchaseState.PURCHASED }
171 | .forEach { purchase ->
172 | val isConsumable = purchase.products.any { inAppProductId == it }
173 | if (isConsumable) {
174 | consumePurchase(purchase)
175 | } else if (!purchase.isAcknowledged) {
176 | acknowledgePurchase(purchase)
177 | }
178 | }
179 | }
180 |
181 | private fun consumePurchase(purchase: Purchase) {
182 | val consumeParams =
183 | ConsumeParams.newBuilder()
184 | .setPurchaseToken(purchase.purchaseToken)
185 | .build()
186 | billingClient.consumeAsync(consumeParams) { billingResult, _ ->
187 | if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
188 | debug("Consumption flow successful. Delivering entitlement.")
189 | } else {
190 | error("Consumption flow error: ${billingResult.debugMessage}")
191 | }
192 | }
193 | debug("Consumption flow started.")
194 | }
195 |
196 | private fun acknowledgePurchase(purchase: Purchase) {
197 | val acknowledgeParams = AcknowledgePurchaseParams.newBuilder()
198 | .setPurchaseToken(purchase.purchaseToken)
199 | .build()
200 | billingClient.acknowledgePurchase(acknowledgeParams) { billingResult ->
201 | if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
202 | debug("Acknowledge flow successful.")
203 | } else {
204 | error("Acknowledge flow error: ${billingResult.debugMessage}")
205 | }
206 | }
207 | debug("Acknowledge flow started.")
208 | }
209 | }
210 |
211 | private val TAG = BillingClient::class.java.simpleName
212 | private fun debug(message: String) = Log.d(TAG, message)
213 | private fun error(message: String) = Log.e(TAG, message)
214 |
--------------------------------------------------------------------------------
/analytics/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/analytics/src/main/res/layout/activity_analytics.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
21 |
22 |
32 |
33 |
43 |
44 |
--------------------------------------------------------------------------------
/analytics/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/analytics/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/analytics/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/analytics/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/analytics/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/analytics/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/analytics/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/analytics/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/analytics/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/analytics/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/analytics/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/analytics/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/analytics/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/analytics/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/analytics/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/analytics/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/analytics/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/analytics/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/analytics/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/analytics/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/analytics/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF000000
4 | #FFFFFFFF
5 |
--------------------------------------------------------------------------------
/analytics/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 16dp
3 |
--------------------------------------------------------------------------------
/analytics/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Appodeal Analytics
3 | LOG EVENT
4 | VALIDATE SUBSCRIPTION
5 | VALIDATE INAPP
6 |
--------------------------------------------------------------------------------
/analytics/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/analytics/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 127.0.0.1
10 |
11 |
--------------------------------------------------------------------------------
/banner/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/banner/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'org.jetbrains.kotlin.android'
4 | }
5 |
6 | android {
7 | compileSdk 34
8 | namespace 'com.appodealstack.demo.banner'
9 |
10 | defaultConfig {
11 | buildConfigField "String", "APP_KEY", "\"d908f77a97ae0993514bc8edba7e776a36593c77e5f44994\""
12 | applicationId "com.appodealstack.demo"
13 | minSdkVersion 21
14 | targetSdkVersion 34
15 | versionCode 1
16 | versionName "1.0"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_11
26 | targetCompatibility JavaVersion.VERSION_11
27 | }
28 | kotlinOptions {
29 | jvmTarget = '11'
30 | }
31 | buildFeatures {
32 | viewBinding true
33 | buildConfig true
34 | }
35 | }
36 |
37 | dependencies {
38 | implementation 'androidx.core:core-ktx:1.13.1'
39 | implementation 'androidx.appcompat:appcompat:1.7.0'
40 | implementation 'com.google.android.material:material:1.12.0'
41 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
42 | // Appodeal SDK 3.6.0.0
43 | implementation 'com.appodeal.ads:sdk:3.6.0.0'
44 | }
--------------------------------------------------------------------------------
/banner/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
--------------------------------------------------------------------------------
/banner/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
23 |
24 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
48 |
49 |
52 |
53 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/banner/src/main/java/com/appodealstack/demo/banner/BannerActivity.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.banner
2 |
3 | import android.content.Context
4 | import android.os.Bundle
5 | import android.util.Log
6 | import android.widget.Toast
7 | import androidx.appcompat.app.AppCompatActivity
8 | import com.appodeal.ads.Appodeal
9 | import com.appodeal.ads.BannerCallbacks
10 | import com.appodeal.ads.initializing.ApdInitializationError
11 | import com.appodeal.ads.utils.Log.LogLevel
12 | import com.appodealstack.demo.banner.databinding.ActivityBannerBinding
13 |
14 | class BannerActivity : AppCompatActivity() {
15 |
16 | override fun onCreate(savedInstanceState: Bundle?) {
17 | super.onCreate(savedInstanceState)
18 | val binding = ActivityBannerBinding.inflate(layoutInflater)
19 | setContentView(binding.root)
20 | setUpAppodealSDK(binding)
21 | }
22 |
23 | private fun setUpAppodealSDK(binding: ActivityBannerBinding) {
24 | Appodeal.setLogLevel(LogLevel.verbose)
25 | Appodeal.setTesting(true)
26 | Appodeal.initialize(
27 | this,
28 | BuildConfig.APP_KEY,
29 | Appodeal.BANNER
30 | ) { errors: List? ->
31 | val initResult =
32 | if (errors.isNullOrEmpty()) "successfully" else "with ${errors.size} errors"
33 | showToast("Appodeal initialized $initResult")
34 | errors?.forEach {
35 | Log.e(TAG, "onInitializationFinished: ", it)
36 | }
37 | }
38 |
39 | with(binding) {
40 | showBanner.setOnClickListener {
41 | if (Appodeal.canShow(Appodeal.BANNER, placementName)) {
42 | Appodeal.show(this@BannerActivity, Appodeal.BANNER_BOTTOM, placementName)
43 | } else {
44 | showToast("Cannot show Banner")
45 | }
46 | }
47 | hideBanner.setOnClickListener {
48 | Appodeal.hide(this@BannerActivity, Appodeal.BANNER)
49 | }
50 | }
51 |
52 | Appodeal.setBannerCallbacks(object : BannerCallbacks {
53 |
54 | override fun onBannerLoaded(height: Int, isPrecache: Boolean) {
55 | showToast("Banner was loaded, isPrecache: $isPrecache")
56 | }
57 |
58 | override fun onBannerFailedToLoad() {
59 | showToast("Banner failed to load")
60 | }
61 |
62 | override fun onBannerClicked() {
63 | showToast("Banner was clicked")
64 | }
65 |
66 | override fun onBannerShowFailed() {
67 | showToast("Banner failed to show")
68 | }
69 |
70 | override fun onBannerShown() {
71 | showToast("Banner was shown")
72 | }
73 |
74 | override fun onBannerExpired() {
75 | showToast("Banner was expired")
76 | }
77 | })
78 | }
79 | }
80 |
81 | private const val placementName = "default"
82 | private const val TAG = "BannerActivity"
83 | private fun Context.showToast(message: String) =
84 | Toast.makeText(applicationContext, message, Toast.LENGTH_SHORT).show()
--------------------------------------------------------------------------------
/banner/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/banner/src/main/res/layout/activity_banner.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
21 |
22 |
32 |
33 |
--------------------------------------------------------------------------------
/banner/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/banner/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/banner/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/banner/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/banner/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/banner/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/banner/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/banner/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/banner/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/banner/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/banner/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/banner/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/banner/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/banner/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/banner/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/banner/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/banner/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/banner/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/banner/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/banner/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/banner/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Appodeal Banner
3 | SHOW BANNER
4 | HIDE BANNER
5 |
--------------------------------------------------------------------------------
/banner/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/banner/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 127.0.0.1
10 |
11 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:8.5.1'
8 | classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10'
9 | classpath 'com.google.gms:google-services:4.4.2' // Google Services plugin
10 | }
11 | }
12 |
13 | allprojects {
14 | repositories {
15 | google()
16 | mavenCentral()
17 | // Add Appodeal repository
18 | maven { url "https://artifactory.appodeal.com/appodeal" }
19 | }
20 | }
21 |
22 | tasks.register('clean', Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx4096m
2 | android.enableJetifier=false
3 | android.useAndroidX=true
4 | org.gradle.unsafe.configuration-cache=true
5 | android.nonTransitiveRClass=false
6 | android.nonFinalResIds=false
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84 |
85 | APP_NAME="Gradle"
86 | APP_BASE_NAME=${0##*/}
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | MAX_FD=$( ulimit -H -n ) ||
147 | warn "Could not query maximum file descriptor limit"
148 | esac
149 | case $MAX_FD in #(
150 | '' | soft) :;; #(
151 | *)
152 | ulimit -n "$MAX_FD" ||
153 | warn "Could not set maximum file descriptor limit to $MAX_FD"
154 | esac
155 | fi
156 |
157 | # Collect all arguments for the java command, stacking in reverse order:
158 | # * args from the command line
159 | # * the main class name
160 | # * -classpath
161 | # * -D...appname settings
162 | # * --module-path (only if needed)
163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164 |
165 | # For Cygwin or MSYS, switch paths to Windows format before running java
166 | if "$cygwin" || "$msys" ; then
167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169 |
170 | JAVACMD=$( cygpath --unix "$JAVACMD" )
171 |
172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
173 | for arg do
174 | if
175 | case $arg in #(
176 | -*) false ;; # don't mess with options #(
177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178 | [ -e "$t" ] ;; #(
179 | *) false ;;
180 | esac
181 | then
182 | arg=$( cygpath --path --ignore --mixed "$arg" )
183 | fi
184 | # Roll the args list around exactly as many times as the number of
185 | # args, so each arg winds up back in the position where it started, but
186 | # possibly modified.
187 | #
188 | # NB: a `for` loop captures its iteration list before it begins, so
189 | # changing the positional parameters here affects neither the number of
190 | # iterations, nor the values presented in `arg`.
191 | shift # remove old arg
192 | set -- "$@" "$arg" # push replacement arg
193 | done
194 | fi
195 |
196 | # Collect all arguments for the java command;
197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198 | # shell script including quotes and variable substitutions, so put them in
199 | # double quotes to make sure that they get re-expanded; and
200 | # * put everything else in single quotes, so that it's not re-expanded.
201 |
202 | set -- \
203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
204 | -classpath "$CLASSPATH" \
205 | org.gradle.wrapper.GradleWrapperMain \
206 | "$@"
207 |
208 | # Use "xargs" to parse quoted args.
209 | #
210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211 | #
212 | # In Bash we could simply go:
213 | #
214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215 | # set -- "${ARGS[@]}" "$@"
216 | #
217 | # but POSIX shell has neither arrays nor command substitution, so instead we
218 | # post-process each arg (as a line of input to sed) to backslash-escape any
219 | # character that might be a shell metacharacter, then use eval to reverse
220 | # that process (while maintaining the separation between arguments), and wrap
221 | # the whole thing up as a single "set" statement.
222 | #
223 | # This will of course break if any of these variables contains a newline or
224 | # an unmatched quote.
225 | #
226 |
227 | eval "set -- $(
228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229 | xargs -n1 |
230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231 | tr '\n' ' '
232 | )" '"$@"'
233 |
234 | exec "$JAVACMD" "$@"
235 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/interstitial/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/interstitial/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'org.jetbrains.kotlin.android'
4 | }
5 |
6 | android {
7 | compileSdk 34
8 | namespace 'com.appodealstack.demo.interstitial'
9 |
10 | defaultConfig {
11 | buildConfigField "String", "APP_KEY", "\"d908f77a97ae0993514bc8edba7e776a36593c77e5f44994\""
12 | applicationId "com.appodealstack.demo"
13 | minSdkVersion 21
14 | targetSdkVersion 34
15 | versionCode 1
16 | versionName "1.0"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_11
26 | targetCompatibility JavaVersion.VERSION_11
27 | }
28 | kotlinOptions {
29 | jvmTarget = '11'
30 | }
31 | buildFeatures {
32 | viewBinding true
33 | buildConfig true
34 | }
35 | }
36 |
37 | dependencies {
38 | implementation 'androidx.core:core-ktx:1.13.1'
39 | implementation 'androidx.appcompat:appcompat:1.7.0'
40 | implementation 'com.google.android.material:material:1.12.0'
41 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
42 | // Appodeal SDK 3.6.0.0
43 | implementation 'com.appodeal.ads:sdk:3.6.0.0'
44 | }
--------------------------------------------------------------------------------
/interstitial/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
--------------------------------------------------------------------------------
/interstitial/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
23 |
24 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
51 |
52 |
55 |
56 |
--------------------------------------------------------------------------------
/interstitial/src/main/java/com/appodealstack/demo/interstitial/InterstitialActivity.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.interstitial
2 |
3 | import android.content.Context
4 | import android.os.Bundle
5 | import android.util.Log
6 | import android.widget.Toast
7 | import androidx.appcompat.app.AppCompatActivity
8 | import com.appodeal.ads.Appodeal
9 | import com.appodeal.ads.InterstitialCallbacks
10 | import com.appodeal.ads.initializing.ApdInitializationError
11 | import com.appodeal.ads.utils.Log.LogLevel
12 | import com.appodealstack.demo.interstitial.databinding.ActivityInterstitialBinding
13 |
14 | class InterstitialActivity : AppCompatActivity() {
15 |
16 | override fun onCreate(savedInstanceState: Bundle?) {
17 | super.onCreate(savedInstanceState)
18 | val binding = ActivityInterstitialBinding.inflate(layoutInflater)
19 | setContentView(binding.root)
20 | setUpAppodealSDK(binding)
21 | }
22 |
23 | private fun setUpAppodealSDK(binding: ActivityInterstitialBinding) {
24 | Appodeal.setTesting(true)
25 | Appodeal.setLogLevel(LogLevel.verbose)
26 | Appodeal.initialize(
27 | this,
28 | BuildConfig.APP_KEY,
29 | Appodeal.INTERSTITIAL
30 | ) { errors: List? ->
31 | val initResult =
32 | if (errors.isNullOrEmpty()) "successfully" else "with ${errors.size} errors"
33 | showToast("Appodeal initialized $initResult")
34 | errors?.forEach {
35 | Log.e(TAG, "onInitializationFinished: ", it)
36 | }
37 | }
38 | with(binding) {
39 | showInterstitial.setOnClickListener {
40 | if (Appodeal.canShow(Appodeal.INTERSTITIAL, placementName)) {
41 | Appodeal.show(this@InterstitialActivity, Appodeal.INTERSTITIAL, placementName)
42 | } else {
43 | showToast("Cannot show interstitial")
44 | }
45 | }
46 |
47 | cacheInterstitial.setOnClickListener {
48 | Appodeal.cache(this@InterstitialActivity, Appodeal.INTERSTITIAL)
49 | }
50 |
51 | autocacheInterstitial.setOnCheckedChangeListener { _, isChecked ->
52 | cacheInterstitial.isEnabled = !isChecked
53 | Appodeal.setAutoCache(Appodeal.INTERSTITIAL, isChecked)
54 | }
55 | }
56 |
57 | Appodeal.setInterstitialCallbacks(object : InterstitialCallbacks {
58 | override fun onInterstitialLoaded(isPrecache: Boolean) {
59 | showToast("Interstitial was loaded, isPrecache: $isPrecache")
60 | }
61 |
62 | override fun onInterstitialFailedToLoad() {
63 | showToast("Interstitial failed to load")
64 | }
65 |
66 | override fun onInterstitialClicked() {
67 | showToast("Interstitial was clicked")
68 | }
69 |
70 | override fun onInterstitialShowFailed() {
71 | showToast("Interstitial failed to show")
72 | }
73 |
74 | override fun onInterstitialShown() {
75 | showToast("Interstitial was shown")
76 | }
77 |
78 | override fun onInterstitialClosed() {
79 | showToast("Interstitial was closed")
80 | }
81 |
82 | override fun onInterstitialExpired() {
83 | showToast("Interstitial was expired")
84 | }
85 | })
86 | }
87 | }
88 |
89 | private const val placementName = "default"
90 | private const val TAG = "InterstitialActivity"
91 | private fun Context.showToast(message: String) =
92 | Toast.makeText(applicationContext, message, Toast.LENGTH_SHORT).show()
--------------------------------------------------------------------------------
/interstitial/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/interstitial/src/main/res/layout/activity_interstitial.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
21 |
22 |
33 |
34 |
44 |
45 |
--------------------------------------------------------------------------------
/interstitial/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/interstitial/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/interstitial/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/interstitial/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/interstitial/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/interstitial/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/interstitial/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/interstitial/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/interstitial/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/interstitial/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/interstitial/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/interstitial/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/interstitial/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/interstitial/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/interstitial/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/interstitial/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/interstitial/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/interstitial/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/interstitial/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/interstitial/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/interstitial/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Appodeal interstitial
3 | SHOW INTERSTITIAL
4 | Autocache
5 | CACHE INTERSTITIAL
6 |
--------------------------------------------------------------------------------
/interstitial/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/interstitial/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 127.0.0.1
10 |
11 |
--------------------------------------------------------------------------------
/mrec/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/mrec/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'org.jetbrains.kotlin.android'
4 | }
5 |
6 | android {
7 | compileSdk 34
8 | namespace 'com.appodealstack.demo.mrec'
9 |
10 | defaultConfig {
11 | buildConfigField "String", "APP_KEY", "\"d908f77a97ae0993514bc8edba7e776a36593c77e5f44994\""
12 | applicationId "com.appodealstack.demo"
13 | minSdkVersion 21
14 | targetSdkVersion 34
15 | versionCode 1
16 | versionName "1.0"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_11
26 | targetCompatibility JavaVersion.VERSION_11
27 | }
28 | kotlinOptions {
29 | jvmTarget = '11'
30 | }
31 | buildFeatures {
32 | viewBinding true
33 | buildConfig true
34 | }
35 | }
36 |
37 | dependencies {
38 | implementation 'androidx.core:core-ktx:1.13.1'
39 | implementation 'androidx.appcompat:appcompat:1.7.0'
40 | implementation 'com.google.android.material:material:1.12.0'
41 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
42 | // Appodeal SDK 3.6.0.0
43 | implementation 'com.appodeal.ads:sdk:3.6.0.0'
44 | }
--------------------------------------------------------------------------------
/mrec/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
--------------------------------------------------------------------------------
/mrec/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
23 |
24 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
48 |
49 |
52 |
53 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/mrec/src/main/java/com/appodealstack/demo/mrec/MrecActivity.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.mrec
2 |
3 | import android.content.Context
4 | import android.os.Bundle
5 | import android.util.Log
6 | import android.widget.Toast
7 | import androidx.appcompat.app.AppCompatActivity
8 | import com.appodeal.ads.Appodeal
9 | import com.appodeal.ads.MrecCallbacks
10 | import com.appodeal.ads.initializing.ApdInitializationError
11 | import com.appodeal.ads.utils.Log.*
12 | import com.appodealstack.demo.mrec.databinding.ActivityMrecBinding
13 |
14 | class MrecActivity : AppCompatActivity() {
15 |
16 | override fun onCreate(savedInstanceState: Bundle?) {
17 | super.onCreate(savedInstanceState)
18 | val binding = ActivityMrecBinding.inflate(layoutInflater)
19 | setContentView(binding.root)
20 | setUpAppodealSDK(binding)
21 | }
22 |
23 | private fun setUpAppodealSDK(binding: ActivityMrecBinding) {
24 | Appodeal.setLogLevel(LogLevel.verbose)
25 | Appodeal.setTesting(true)
26 | Appodeal.setMrecViewId(R.id.appodealMrecView)
27 | Appodeal.initialize(
28 | this,
29 | BuildConfig.APP_KEY,
30 | Appodeal.MREC
31 | ) { errors: List? ->
32 | val initResult =
33 | if (errors.isNullOrEmpty()) "successfully" else "with ${errors.size} errors"
34 | showToast("Appodeal initialized $initResult")
35 | errors?.forEach {
36 | Log.e(TAG, "onInitializationFinished: ", it)
37 | }
38 | }
39 |
40 | with(binding) {
41 | showMrec.setOnClickListener {
42 | if (Appodeal.canShow(Appodeal.MREC, placementName)) {
43 | Appodeal.show(this@MrecActivity, Appodeal.MREC, placementName)
44 | } else {
45 | showToast("Cannot show MREC")
46 | }
47 | }
48 | hideMrec.setOnClickListener {
49 | Appodeal.hide(this@MrecActivity, Appodeal.MREC)
50 | }
51 | }
52 |
53 | Appodeal.setMrecCallbacks(object : MrecCallbacks {
54 | override fun onMrecLoaded(isPrecache: Boolean) {
55 | showToast("MREC was loaded, isPrecache: $isPrecache")
56 | }
57 |
58 | override fun onMrecFailedToLoad() {
59 | showToast("MREC failed to load")
60 | }
61 |
62 | override fun onMrecClicked() {
63 | showToast("MREC was clicked")
64 | }
65 |
66 | override fun onMrecShowFailed() {
67 | showToast("MREC failed to show")
68 | }
69 |
70 | override fun onMrecShown() {
71 | showToast("MREC was shown")
72 | }
73 |
74 | override fun onMrecExpired() {
75 | showToast("MREC was expired")
76 | }
77 | })
78 | }
79 | }
80 |
81 | private const val placementName = "default"
82 | private const val TAG = "MrecActivity"
83 | private fun Context.showToast(message: String) =
84 | Toast.makeText(applicationContext, message, Toast.LENGTH_SHORT).show()
--------------------------------------------------------------------------------
/mrec/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/mrec/src/main/res/layout/activity_mrec.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
21 |
22 |
32 |
33 |
44 |
45 |
--------------------------------------------------------------------------------
/mrec/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/mrec/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/mrec/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/mrec/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/mrec/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/mrec/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/mrec/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/mrec/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/mrec/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/mrec/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/mrec/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/mrec/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/mrec/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/mrec/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/mrec/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/mrec/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/mrec/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/mrec/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/mrec/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/mrec/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/mrec/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Appodeal MREC
3 | SHOW MREC
4 | HIDE MREC
5 |
--------------------------------------------------------------------------------
/mrec/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/mrec/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 127.0.0.1
10 |
11 |
--------------------------------------------------------------------------------
/native/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/native/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'org.jetbrains.kotlin.android'
4 | }
5 |
6 | android {
7 | compileSdk 34
8 | namespace 'com.appodealstack.demo.nativead'
9 |
10 | defaultConfig {
11 | buildConfigField "String", "APP_KEY", "\"d908f77a97ae0993514bc8edba7e776a36593c77e5f44994\""
12 | applicationId "com.appodealstack.demo"
13 | minSdkVersion 21
14 | targetSdkVersion 34
15 | versionCode 1
16 | versionName "1.0"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_11
26 | targetCompatibility JavaVersion.VERSION_11
27 | }
28 | kotlinOptions {
29 | jvmTarget = '11'
30 | }
31 | buildFeatures {
32 | viewBinding true
33 | buildConfig true
34 | }
35 | }
36 |
37 | dependencies {
38 | implementation 'androidx.core:core-ktx:1.13.1'
39 | implementation 'androidx.appcompat:appcompat:1.7.0'
40 | implementation 'com.google.android.material:material:1.12.0'
41 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
42 | // Appodeal SDK 3.6.0.0
43 | implementation 'com.appodeal.ads:sdk:3.6.0.0'
44 | }
--------------------------------------------------------------------------------
/native/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
--------------------------------------------------------------------------------
/native/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
18 |
21 |
22 |
31 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
46 |
47 |
50 |
51 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/native/src/main/java/com/appodealstack/demo/nativead/NativeActivity.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.nativead
2 |
3 | import android.content.Context
4 | import android.graphics.Color
5 | import android.os.Bundle
6 | import android.util.Log
7 | import android.widget.Toast
8 | import androidx.appcompat.app.AppCompatActivity
9 | import androidx.core.view.isVisible
10 | import com.appodeal.ads.Appodeal
11 | import com.appodeal.ads.NativeAd
12 | import com.appodeal.ads.NativeCallbacks
13 | import com.appodeal.ads.NativeMediaViewContentType
14 | import com.appodeal.ads.initializing.ApdInitializationError
15 | import com.appodeal.ads.nativead.NativeAdView
16 | import com.appodeal.ads.nativead.NativeAdViewAppWall
17 | import com.appodeal.ads.nativead.NativeAdViewContentStream
18 | import com.appodeal.ads.nativead.NativeAdViewNewsFeed
19 | import com.appodeal.ads.nativead.Position
20 | import com.appodeal.ads.utils.Log.LogLevel
21 | import com.appodealstack.demo.nativead.databinding.ActivityNativeBinding
22 |
23 | class NativeActivity : AppCompatActivity() {
24 |
25 | override fun onCreate(savedInstanceState: Bundle?) {
26 | super.onCreate(savedInstanceState)
27 | val binding = ActivityNativeBinding.inflate(layoutInflater)
28 | setContentView(binding.root)
29 | setUpAppodealSDK(binding)
30 | }
31 |
32 | private fun setUpAppodealSDK(binding: ActivityNativeBinding) {
33 | Appodeal.setLogLevel(LogLevel.verbose)
34 | Appodeal.setTesting(true)
35 | Appodeal.setPreferredNativeContentType(NativeMediaViewContentType.Auto)
36 | Appodeal.initialize(
37 | this,
38 | BuildConfig.APP_KEY,
39 | Appodeal.NATIVE
40 | ) { errors: List? ->
41 | val initResult =
42 | if (errors.isNullOrEmpty()) "successfully" else "with ${errors.size} errors"
43 | showToast("Appodeal initialized $initResult")
44 | errors?.forEach {
45 | Log.e(TAG, "onInitializationFinished: ", it)
46 | }
47 | }
48 |
49 | with(binding) {
50 | showNative.setOnClickListener {
51 | val nativeAd = Appodeal.getNativeAds(1).firstOrNull()
52 | if (nativeAd == null) {
53 | showToast("Native ad has not loaded")
54 | return@setOnClickListener
55 | }
56 | if (nativeAd.canShow(this@NativeActivity, placementName)) {
57 | when (nativeAdViewType) {
58 | NativeAdViewAppWall::class -> {
59 | configureNativeAdView(nativeAdViewAppWall)
60 | nativeAdViewAppWall.registerView(nativeAd)
61 | }
62 |
63 | NativeAdViewNewsFeed::class -> {
64 | configureNativeAdView(nativeAdViewNewsFeed)
65 | nativeAdViewNewsFeed.registerView(nativeAd)
66 | }
67 |
68 | NativeAdViewContentStream::class -> {
69 | configureNativeAdView(nativeAdViewContentStream)
70 | nativeAdViewContentStream.registerView(nativeAd)
71 | }
72 |
73 | else -> {
74 | configureNativeAdView(binding.nativeAdViewCustom.root)
75 | binding.nativeAdViewCustom.root.registerView(nativeAd)
76 | }
77 | }
78 | } else {
79 | showToast("Cannot show Native")
80 | }
81 | }
82 | hideNative.setOnClickListener {
83 | when (nativeAdViewType) {
84 | NativeAdViewAppWall::class -> {
85 | nativeAdViewAppWall.isVisible = false
86 | nativeAdViewAppWall.unregisterView()
87 | }
88 |
89 | NativeAdViewNewsFeed::class -> {
90 | nativeAdViewNewsFeed.isVisible = false
91 | nativeAdViewNewsFeed.unregisterView()
92 | }
93 |
94 | NativeAdViewContentStream::class -> {
95 | nativeAdViewContentStream.isVisible = false
96 | nativeAdViewContentStream.unregisterView()
97 | }
98 |
99 | else -> {
100 | nativeAdViewCustom.root.isVisible = false
101 | nativeAdViewCustom.root.unregisterView()
102 | }
103 | }
104 | }
105 | showInList.setOnClickListener {
106 | supportFragmentManager.beginTransaction()
107 | .replace(R.id.activity_root_container, NativeListFragment())
108 | .addToBackStack(TAG)
109 | .commitAllowingStateLoss()
110 | }
111 | }
112 |
113 | Appodeal.setNativeCallbacks(object : NativeCallbacks {
114 | override fun onNativeLoaded() {
115 | showToast("Native was loaded")
116 | }
117 |
118 | override fun onNativeFailedToLoad() {
119 | showToast("Native failed to load")
120 | }
121 |
122 | override fun onNativeClicked(nativeAd: NativeAd?) {
123 | showToast("Native was clicked")
124 | }
125 |
126 | override fun onNativeShowFailed(nativeAd: NativeAd?) {
127 | showToast("Native failed to show")
128 | }
129 |
130 | override fun onNativeShown(nativeAd: NativeAd?) {
131 | showToast("Native was shown")
132 | }
133 |
134 | override fun onNativeExpired() {
135 | showToast("Native was expired")
136 | }
137 | })
138 | }
139 |
140 | companion object {
141 | /**
142 | * Use NativeAdView::class to checking your custom layout view.
143 | * Use NativeAdViewNewsFeed::class or
144 | * NativeAdViewContentStream::class or
145 | * NativeAdViewAppWall::class to check native templates
146 | * */
147 | val nativeAdViewType = NativeAdView::class
148 |
149 | fun configureNativeAdView(nativeAdView: NativeAdView) {
150 | nativeAdView.setAdChoicesPosition(Position.END_TOP)
151 | nativeAdView.setAdAttributionBackground(Color.RED)
152 | nativeAdView.setAdAttributionTextColor(Color.WHITE)
153 | }
154 | }
155 | }
156 |
157 | private const val placementName = "default"
158 | private const val TAG = "NativeActivity"
159 | private fun Context.showToast(message: String) =
160 | Toast.makeText(applicationContext, message, Toast.LENGTH_SHORT).show()
--------------------------------------------------------------------------------
/native/src/main/java/com/appodealstack/demo/nativead/NativeListFragment.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.nativead
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.fragment.app.Fragment
8 | import com.appodeal.ads.Appodeal
9 | import com.appodeal.ads.NativeAd
10 | import com.appodealstack.demo.nativead.adapter.ListItem
11 | import com.appodealstack.demo.nativead.adapter.NativeListAdapter
12 | import com.appodealstack.demo.nativead.databinding.NativeListFragmentBinding
13 |
14 | class NativeListFragment : Fragment() {
15 |
16 | /**
17 | * Retrieves a native ad instance for binding.
18 | *
19 | * @return A [NativeAd] instance if available, or null if no native ads are present.
20 | */
21 | private val getNativeAd: () -> NativeAd? = { Appodeal.getNativeAds(1).firstOrNull() }
22 |
23 | override fun onCreateView(
24 | inflater: LayoutInflater, container: ViewGroup?,
25 | savedInstanceState: Bundle?
26 | ): View {
27 | val binding = NativeListFragmentBinding.inflate(inflater, container, false)
28 | val nativeListAdapter = NativeListAdapter()
29 | binding.recyclerView.adapter = nativeListAdapter
30 | obtainData(nativeListAdapter)
31 | return binding.root
32 | }
33 |
34 | private fun obtainData(nativeListAdapter: NativeListAdapter) {
35 | val yourDataItems = generateYourData()
36 | nativeListAdapter.submitList(yourDataItems.addNativeAdItems())
37 | }
38 |
39 | private fun List.addNativeAdItems() =
40 | this.foldIndexed(
41 | initial = listOf(),
42 | operation = { index: Int, acc: List, yourDataItem: ListItem ->
43 | val shouldAdd = index % STEPS == 0 && index != 0
44 | if (shouldAdd) {
45 | acc + createDynamicNativeAd() + yourDataItem
46 | } else {
47 | acc + yourDataItem
48 | }
49 | }
50 | )
51 |
52 | private fun generateYourData(): List =
53 | (1..USER_DATA_SIZE).toList().map { ListItem.YourDataItem(userData = it) }
54 |
55 | private fun createDynamicNativeAd(): ListItem.DynamicNativeAdItem =
56 | ListItem.DynamicNativeAdItem(getNativeAd = getNativeAd)
57 | }
58 |
59 | private const val USER_DATA_SIZE = 200
60 | private const val STEPS = 5
--------------------------------------------------------------------------------
/native/src/main/java/com/appodealstack/demo/nativead/adapter/DiffUtils.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.nativead.adapter
2 |
3 | import androidx.recyclerview.widget.DiffUtil
4 |
5 | internal class DiffUtils : DiffUtil.ItemCallback() {
6 | override fun areItemsTheSame(oldItem: ListItem, newItem: ListItem) =
7 | oldItem.getItemId() == newItem.getItemId()
8 |
9 | override fun areContentsTheSame(oldItem: ListItem, newItem: ListItem) =
10 | oldItem.hashCode() == newItem.hashCode()
11 | }
--------------------------------------------------------------------------------
/native/src/main/java/com/appodealstack/demo/nativead/adapter/ListItem.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.nativead.adapter
2 |
3 | import com.appodeal.ads.NativeAd
4 |
5 | sealed interface ListItem {
6 | fun getItemId(): Int
7 |
8 | class DynamicNativeAdItem(val getNativeAd: () -> NativeAd?) : ListItem {
9 | override fun getItemId() = DYNAMIC_AD_ITEM
10 |
11 | companion object {
12 | const val DYNAMIC_AD_ITEM = 3
13 | }
14 | }
15 |
16 | data class YourDataItem(val userData: Int) : ListItem {
17 | override fun getItemId() = USER_ITEM
18 |
19 | companion object {
20 | const val USER_ITEM = 2
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/native/src/main/java/com/appodealstack/demo/nativead/adapter/NativeListAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.nativead.adapter
2 |
3 | import android.view.LayoutInflater
4 | import android.view.View
5 | import android.view.ViewGroup
6 | import androidx.recyclerview.widget.ListAdapter
7 | import androidx.recyclerview.widget.RecyclerView
8 | import com.appodeal.ads.nativead.NativeAdView
9 | import com.appodeal.ads.nativead.NativeAdViewAppWall
10 | import com.appodeal.ads.nativead.NativeAdViewContentStream
11 | import com.appodeal.ads.nativead.NativeAdViewNewsFeed
12 | import com.appodealstack.demo.nativead.NativeActivity
13 | import com.appodealstack.demo.nativead.NativeActivity.Companion.configureNativeAdView
14 | import com.appodealstack.demo.nativead.adapter.ListItem.DynamicNativeAdItem.Companion.DYNAMIC_AD_ITEM
15 | import com.appodealstack.demo.nativead.adapter.ListItem.YourDataItem.Companion.USER_ITEM
16 | import com.appodealstack.demo.nativead.adapter.NativeListAdapter.ListHolder
17 | import com.appodealstack.demo.nativead.adapter.NativeListAdapter.ListHolder.DynamicAdViewHolder
18 | import com.appodealstack.demo.nativead.adapter.NativeListAdapter.ListHolder.YourViewHolder
19 | import com.appodealstack.demo.nativead.databinding.NativeAdViewCustomBinding
20 | import com.appodealstack.demo.nativead.databinding.YourDataItemBinding
21 |
22 | class NativeListAdapter : ListAdapter(DiffUtils()) {
23 |
24 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ListHolder {
25 | return when (viewType) {
26 | DYNAMIC_AD_ITEM -> {
27 | val nativeAdView = createNativeAdView(parent)
28 | DynamicAdViewHolder(nativeAdView)
29 | }
30 | else -> {
31 | val binding =
32 | YourDataItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
33 | YourViewHolder(binding)
34 | }
35 | }
36 | }
37 |
38 | override fun onBindViewHolder(holder: ListHolder, position: Int) {
39 | when (val item = getItem(position)) {
40 | is ListItem.YourDataItem -> (holder as YourViewHolder).bind(item)
41 | is ListItem.DynamicNativeAdItem -> (holder as DynamicAdViewHolder).bind(item)
42 | }
43 | }
44 |
45 | override fun getItemViewType(position: Int): Int {
46 | return when (currentList[position]) {
47 | is ListItem.YourDataItem -> USER_ITEM
48 | is ListItem.DynamicNativeAdItem -> DYNAMIC_AD_ITEM
49 | }
50 | }
51 |
52 | sealed class ListHolder(root: View) : RecyclerView.ViewHolder(root) {
53 | class YourViewHolder(private val binding: YourDataItemBinding) : ListHolder(binding.root) {
54 | fun bind(item: ListItem.YourDataItem) {
55 | binding.root.text = item.userData.toString()
56 | }
57 | }
58 |
59 | class DynamicAdViewHolder(itemView: View) : ListHolder(itemView) {
60 | fun bind(item: ListItem.DynamicNativeAdItem) {
61 | val nativeAd = item.getNativeAd.invoke() ?: return
62 | (itemView as NativeAdView).registerView(nativeAd)
63 | }
64 | }
65 | }
66 |
67 | private fun createNativeAdView(parent: ViewGroup): NativeAdView {
68 | val context = parent.context
69 | val nativeAdView = when (NativeActivity.nativeAdViewType) {
70 | NativeAdViewAppWall::class -> NativeAdViewAppWall(context)
71 | NativeAdViewNewsFeed::class -> NativeAdViewNewsFeed(context)
72 | NativeAdViewContentStream::class -> NativeAdViewContentStream(context)
73 | else -> NativeAdViewCustomBinding.inflate(LayoutInflater.from(context), parent, false).root
74 | }
75 | configureNativeAdView(nativeAdView)
76 | return nativeAdView
77 | }
78 | }
79 |
80 |
--------------------------------------------------------------------------------
/native/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/native/src/main/res/drawable/native_custom_round_outline.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/native/src/main/res/layout/activity_native.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
23 |
24 |
34 |
35 |
45 |
46 |
59 |
60 |
73 |
74 |
87 |
88 |
98 |
99 |
--------------------------------------------------------------------------------
/native/src/main/res/layout/native_ad_view_custom.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
30 |
31 |
37 |
38 |
45 |
46 |
57 |
58 |
76 |
77 |
90 |
91 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/native/src/main/res/layout/native_list_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
--------------------------------------------------------------------------------
/native/src/main/res/layout/your_data_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/native/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/native/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/native/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/native/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/native/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/native/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/native/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/native/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/native/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/native/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/native/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/native/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/native/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/native/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/native/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/native/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/native/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/native/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/native/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/native/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/native/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #000000
4 | #FF0000
5 |
--------------------------------------------------------------------------------
/native/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 10dp
4 | 8dp
5 | 0dp
6 | 8dp
7 | 0dp
8 | 8dp
9 | 0dp
10 | 8dp
11 | 8dp
12 | 20dp
13 | 2dp
14 |
--------------------------------------------------------------------------------
/native/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Appodeal Native
3 | SHOW NATIVE
4 | HIDE NATIVE
5 | SHOW IN LIST
6 |
7 | Ad
8 | Appodeal banner icon
9 |
--------------------------------------------------------------------------------
/native/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/native/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 127.0.0.1
10 |
11 |
--------------------------------------------------------------------------------
/rewarded/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/rewarded/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'org.jetbrains.kotlin.android'
4 | }
5 |
6 | android {
7 | compileSdk 34
8 | namespace 'com.appodealstack.demo.rewarded'
9 |
10 | defaultConfig {
11 | buildConfigField "String", "APP_KEY", "\"d908f77a97ae0993514bc8edba7e776a36593c77e5f44994\""
12 | applicationId "com.appodealstack.demo"
13 | minSdkVersion 21
14 | targetSdkVersion 34
15 | versionCode 1
16 | versionName "1.0"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_11
26 | targetCompatibility JavaVersion.VERSION_11
27 | }
28 | kotlinOptions {
29 | jvmTarget = '11'
30 | }
31 | buildFeatures {
32 | viewBinding true
33 | buildConfig true
34 | }
35 | }
36 |
37 | dependencies {
38 | implementation 'androidx.core:core-ktx:1.13.1'
39 | implementation 'androidx.appcompat:appcompat:1.7.0'
40 | implementation 'com.google.android.material:material:1.12.0'
41 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
42 | // Appodeal SDK 3.6.0.0
43 | implementation 'com.appodeal.ads:sdk:3.6.0.0'
44 | }
--------------------------------------------------------------------------------
/rewarded/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
--------------------------------------------------------------------------------
/rewarded/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
23 |
24 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
49 |
50 |
53 |
54 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/rewarded/src/main/java/com/appodealstack/demo/rewarded/RewardedActivity.kt:
--------------------------------------------------------------------------------
1 | package com.appodealstack.demo.rewarded
2 |
3 | import android.content.Context
4 | import android.os.Bundle
5 | import android.util.Log
6 | import android.widget.Toast
7 | import androidx.appcompat.app.AppCompatActivity
8 | import com.appodeal.ads.Appodeal
9 | import com.appodeal.ads.RewardedVideoCallbacks
10 | import com.appodeal.ads.utils.Log.*
11 | import com.appodealstack.demo.rewarded.databinding.ActivityRewardedBinding
12 |
13 | class RewardedActivity : AppCompatActivity() {
14 |
15 | override fun onCreate(savedInstanceState: Bundle?) {
16 | super.onCreate(savedInstanceState)
17 | val binding = ActivityRewardedBinding.inflate(layoutInflater)
18 | setContentView(binding.root)
19 | setUpAppodealSDK(binding)
20 | }
21 |
22 | private fun setUpAppodealSDK(binding: ActivityRewardedBinding) {
23 | Appodeal.setLogLevel(LogLevel.verbose)
24 | Appodeal.setTesting(true)
25 | Appodeal.initialize(
26 | this,
27 | BuildConfig.APP_KEY,
28 | Appodeal.REWARDED_VIDEO
29 | ) { errors ->
30 | val initResult =
31 | if (errors.isNullOrEmpty()) "successfully" else "with ${errors.size} errors"
32 | showToast("Appodeal initialized $initResult")
33 | errors?.forEach {
34 | Log.e(TAG, "onInitializationFinished: ", it)
35 | }
36 | }
37 |
38 | with(binding) {
39 | showRewarded.setOnClickListener {
40 | if (Appodeal.canShow(Appodeal.REWARDED_VIDEO, placementName)) {
41 | Appodeal.show(this@RewardedActivity, Appodeal.REWARDED_VIDEO, placementName)
42 | } else {
43 | showToast("Cannot show rewarded video")
44 | }
45 | }
46 |
47 | cacheRewarded.setOnClickListener {
48 | Appodeal.cache(this@RewardedActivity, Appodeal.REWARDED_VIDEO)
49 | }
50 |
51 | autocacheRewarded.setOnCheckedChangeListener { _, isChecked ->
52 | cacheRewarded.isEnabled = !isChecked
53 | Appodeal.setAutoCache(Appodeal.REWARDED_VIDEO, isChecked)
54 | }
55 | }
56 |
57 | Appodeal.setRewardedVideoCallbacks(object : RewardedVideoCallbacks {
58 |
59 | override fun onRewardedVideoLoaded(isPrecache: Boolean) {
60 | showToast("Rewarded video was loaded, isPrecache: $isPrecache")
61 | }
62 |
63 | override fun onRewardedVideoFailedToLoad() {
64 | showToast("Rewarded video failed to load")
65 | }
66 |
67 | override fun onRewardedVideoClicked() {
68 | showToast("Rewarded video was clicked")
69 | }
70 |
71 | override fun onRewardedVideoShowFailed() {
72 | showToast("Rewarded video failed to show")
73 | }
74 |
75 | override fun onRewardedVideoShown() {
76 | showToast("Rewarded video was shown")
77 | }
78 |
79 | override fun onRewardedVideoClosed(finished: Boolean) {
80 | showToast("Rewarded video was closed, isVideoFinished: $finished")
81 | }
82 |
83 | override fun onRewardedVideoFinished(amount: Double, currency: String) {
84 | showToast("Rewarded video was finished, amount: $amount, currency: $currency")
85 | }
86 |
87 | override fun onRewardedVideoExpired() {
88 | showToast("Rewarded video was expired")
89 | }
90 | })
91 | }
92 | }
93 |
94 | private const val placementName = "default"
95 | private val TAG = RewardedActivity::class.java.simpleName
96 | private fun Context.showToast(message: String) =
97 | Toast.makeText(applicationContext, message, Toast.LENGTH_SHORT).show()
--------------------------------------------------------------------------------
/rewarded/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/rewarded/src/main/res/layout/activity_rewarded.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
22 |
23 |
34 |
35 |
45 |
46 |
--------------------------------------------------------------------------------
/rewarded/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/rewarded/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/rewarded/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/rewarded/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/rewarded/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/rewarded/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/rewarded/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/rewarded/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/rewarded/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/rewarded/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/rewarded/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/rewarded/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/rewarded/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/rewarded/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/rewarded/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/rewarded/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/rewarded/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/rewarded/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/rewarded/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appodeal/appodeal-android-sdk/ca89f552701ca358cdc02a076f9df11533efc343/rewarded/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/rewarded/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Appodeal Rewarded video
3 | SHOW REWARDED
4 | Autocache
5 | CACHE REWARDED
6 |
--------------------------------------------------------------------------------
/rewarded/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/rewarded/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 127.0.0.1
10 |
11 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':interstitial'
2 | include ':rewarded'
3 | include ':banner'
4 | include ':mrec'
5 | include ':native'
6 | include ':analytics'
--------------------------------------------------------------------------------