Skip to content

Commit 68916b3

Browse files
Ian BirdIanDBird
authored andcommitted
Bump IMA/GMA versions
1 parent a23b631 commit 68916b3

File tree

6 files changed

+42
-30
lines changed

6 files changed

+42
-30
lines changed

common.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ android {
3030
checkDependencies true
3131
checkReleaseBuilds false
3232
warningsAsErrors true
33-
34-
disable 'GradleDependency'
3533
}
3634
}
3735

dev-app/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ android {
3434
composeOptions {
3535
kotlinCompilerExtensionVersion '1.4.1'
3636
}
37+
38+
lint {
39+
disable 'GradleDependency'
40+
}
3741
}
3842

3943
dependencies {

securesignals-gma/build.gradle

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,10 @@ android {
2323

2424
dependencies {
2525
implementation project(path: ':sdk')
26-
27-
// We only compile against the GMA SDK as the exact version being used should be defined by the consuming
28-
// application.
29-
compileOnly 'com.google.android.gms:play-services-ads:21.5.0'
26+
implementation 'com.google.android.gms:play-services-ads:22.0.0'
3027

3128
testImplementation 'junit:junit:4.13.2'
32-
testImplementation 'com.google.android.gms:play-services-ads:21.5.0'
29+
testImplementation 'com.google.android.gms:play-services-ads:22.0.0'
3330
}
3431

3532
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

securesignals-gma/src/main/java/com/uid2/securesignals/gma/UID2MediationAdapter.kt

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,21 @@ class UID2MediationAdapter : RtbAdapter() {
5151
* Collects the UID2 advertising token, if available.
5252
*/
5353
override fun collectSignals(rtbSignalData: RtbSignalData, signalCallbacks: SignalCallbacks) {
54-
val token = UID2Manager.getInstance().getAdvertisingToken()
55-
if (token != null) {
56-
signalCallbacks.onSuccess(token)
57-
} else {
58-
signalCallbacks.onFailure(AdError(0, "No Advertising Token", "UID2"))
54+
UID2Manager.getInstance().let { manager ->
55+
val token = manager.getAdvertisingToken()
56+
if (token != null) {
57+
signalCallbacks.onSuccess(token)
58+
} else {
59+
// We include the IdentityStatus in the "error" to have better visibility on why the Advertising Token
60+
// was not present. There are a number of valid reasons why we don't have a token, but we are still
61+
// required to report these as "failures".
62+
signalCallbacks.onFailure(
63+
AdError(
64+
manager.currentIdentityStatus.value,
65+
"No Advertising Token",
66+
"UID2")
67+
)
68+
}
5969
}
6070
}
6171
}

securesignals-ima/build.gradle

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,10 @@ android {
2323

2424
dependencies {
2525
implementation project(path: ':sdk')
26-
27-
// We only compile against the IMA SDK as the exact version being used should be defined by the consuming
28-
// application.
29-
compileOnly 'com.google.ads.interactivemedia.v3:interactivemedia:3.29.0'
26+
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.30.0'
3027

3128
testImplementation 'junit:junit:4.13.2'
32-
testImplementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.29.0'
29+
testImplementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.30.0'
3330
}
3431

3532
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

securesignals-ima/src/main/java/com/uid2/securesignals/ima/UID2SecureSignalsAdapter.kt

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,32 @@ class UID2SecureSignalsAdapter: SecureSignalsAdapter {
3535
/**
3636
* Initialises the UID2 SDK with the given Context.
3737
*/
38-
override fun initialize(context: Context?, callback: SecureSignalsInitializeCallback?) {
39-
if (context != null) {
38+
override fun initialize(context: Context, callback: SecureSignalsInitializeCallback) {
39+
// It's possible that the UID2Manager is already initialised. If so, it's a no-op.
40+
if (!UID2Manager.isInitialized()) {
4041
UID2Manager.init(context)
41-
callback?.onSuccess()
42-
} else if (UID2Manager.isInitialized()) {
43-
callback?.onSuccess()
44-
} else {
45-
callback?.onFailure(UID2SecureSignalsException("No Context provided to initialise UID2Manager"))
4642
}
43+
44+
callback.onSuccess()
4745
}
4846

4947
/**
5048
* Collects the UID2 advertising token, if available.
5149
*/
52-
override fun collectSignals(context: Context?, callback: SecureSignalsCollectSignalsCallback?) {
53-
val token = UID2Manager.getInstance().getAdvertisingToken()
54-
if (token != null) {
55-
callback?.onSuccess(token)
56-
} else {
57-
callback?.onFailure(UID2SecureSignalsException("No Advertising Token available"))
50+
override fun collectSignals(context: Context, callback: SecureSignalsCollectSignalsCallback) {
51+
UID2Manager.getInstance().let { manager ->
52+
val token = manager.getAdvertisingToken()
53+
if (token != null) {
54+
callback.onSuccess(token)
55+
} else {
56+
// We include the IdentityStatus in the "error" to have better visibility on why the Advertising Token
57+
// was not present. There are a number of valid reasons why we don't have a token, but we are still
58+
// required to report these as "failures".
59+
callback.onFailure(
60+
UID2SecureSignalsException(
61+
"No Advertising Token available (Status: ${manager.currentIdentityStatus.value})")
62+
)
63+
}
5864
}
5965
}
6066
}

0 commit comments

Comments
 (0)