From c28c97814377aa5e9335cb8a68cf06e46ee8ba20 Mon Sep 17 00:00:00 2001 From: efryntov Date: Thu, 19 Feb 2026 13:19:49 -0500 Subject: [PATCH 1/2] Ads: enable Liftoff / Vungle mediation --- app/build.gradle | 4 ++++ build.gradle | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 80e5d9245..2eaee1631 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -227,6 +227,10 @@ dependencies { implementation "com.google.android.gms:play-services-ads:$rootProject.ext.playServicesAdsVersion" implementation "com.google.android.ump:user-messaging-platform:$rootProject.ext.userMessagingPlatformVersion" + // Liftoff Monetize mediation via AdMob + implementation "com.google.ads.mediation:vungle:$rootProject.ext.liftoffMediationAdapterVersion" + implementation "com.vungle:vungle-ads:$rootProject.ext.vungleAdsVersion" + // Play In-App Updates implementation "com.google.android.play:app-update:$rootProject.ext.playAppUpdateVersion" diff --git a/build.gradle b/build.gradle index 463257878..fb1db9dd4 100644 --- a/build.gradle +++ b/build.gradle @@ -52,8 +52,10 @@ ext { pagingVersion = '2.1.2' locationServicesVersion = '21.0.1' geoHashVersion = '0.22' - playServicesAdsVersion = '24.6.0' - userMessagingPlatformVersion = '3.1.0' + playServicesAdsVersion = '24.9.0' + userMessagingPlatformVersion = '4.0.0' + liftoffMediationAdapterVersion = '7.7.0.1' + vungleAdsVersion = '7.7.0' coreKtxVersion = '1.16.0' playAppUpdateVersion = '2.1.0' } From 1ba55f8ad54ce3fdcb72c25711ee178c01097e7b Mon Sep 17 00:00:00 2001 From: efryntov Date: Fri, 20 Feb 2026 14:03:28 -0500 Subject: [PATCH 2/2] Ads: manifest overrides, guard ConsentManager on < SDK 23 --- app/src/main/AndroidManifest.xml | 2 +- .../java/com/psiphon3/ads/ConsentManager.kt | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index af2465ba7..89d181383 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:installLocation="auto"> - + = 23; on pre-M this is null and all methods become no-ops. + private val consentInformation: ConsentInformation? = + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) + UserMessagingPlatform.getConsentInformation(context) + else null fun gatherConsent(activity: Activity): Completable { + val info = consentInformation ?: return Completable.complete() + return Completable.create { emitter -> if (activity.isFinishing || activity.isDestroyed) { if (!emitter.isDisposed) { @@ -57,7 +64,7 @@ class ConsentManager private constructor(context: Context) { val params = ConsentRequestParameters.Builder() .build() - consentInformation.requestConsentInfoUpdate( + info.requestConsentInfoUpdate( activity, params, { @@ -92,6 +99,8 @@ class ConsentManager private constructor(context: Context) { } fun showPrivacyOptionsForm(activity: Activity): Completable { + consentInformation ?: return Completable.complete() + return Completable.create { emitter -> if (activity.isFinishing || activity.isDestroyed) { if (!emitter.isDisposed) { @@ -114,10 +123,10 @@ class ConsentManager private constructor(context: Context) { } } - fun canRequestAds(): Boolean = consentInformation.canRequestAds() + fun canRequestAds(): Boolean = consentInformation?.canRequestAds() ?: false fun isPrivacyOptionsRequired(): Boolean { - return consentInformation.privacyOptionsRequirementStatus == + return consentInformation?.privacyOptionsRequirementStatus == ConsentInformation.PrivacyOptionsRequirementStatus.REQUIRED } -} \ No newline at end of file +}