diff --git a/dev-app/src/main/AndroidManifest.xml b/dev-app/src/main/AndroidManifest.xml index d9659a6..a08aa98 100644 --- a/dev-app/src/main/AndroidManifest.xml +++ b/dev-app/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ android:icon="@mipmap/ic_launcher" android:allowBackup="false" android:supportsRtl="true" + android:networkSecurityConfig="@xml/network_security_config" tools:targetApi="31"> @@ -18,6 +19,9 @@ + + + diff --git a/dev-app/src/main/java/com/uid2/dev/DevApplication.kt b/dev-app/src/main/java/com/uid2/dev/DevApplication.kt index 703509b..887ee81 100644 --- a/dev-app/src/main/java/com/uid2/dev/DevApplication.kt +++ b/dev-app/src/main/java/com/uid2/dev/DevApplication.kt @@ -3,7 +3,10 @@ package com.uid2.dev import android.app.Application import android.os.StrictMode import android.util.Log +import com.uid2.EUIDManager import com.uid2.UID2Manager +import com.uid2.dev.utils.getMetadata +import com.uid2.dev.utils.isEnvironmentEUID import com.uid2.prebid.UID2Prebid import org.prebid.mobile.PrebidMobile @@ -13,16 +16,32 @@ class DevApplication : Application() { override fun onCreate() { super.onCreate() + val isEnvironmentEUID = getMetadata().isEnvironmentEUID() + // Initialise the UID2Manager class. We will use it's DefaultNetworkSession rather than providing our own // custom implementation. This can be done to allow wrapping something like OkHttp. - UID2Manager.init(context = this, serverUrl = INTEG_SERVER_URL, isLoggingEnabled = true) + if (isEnvironmentEUID) { + EUIDManager.init( + context = this, + EUIDManager.Environment.Custom(EUID_INTEG_SERVER_URL), + isLoggingEnabled = true, + ) + } else { + UID2Manager.init( + context = this, + UID2Manager.Environment.Custom(UID2_INTEG_SERVER_URL), + isLoggingEnabled = true, + ) + } // Alternatively, we could initialise the UID2Manager with our own custom NetworkSession... // UID2Manager.init(this, INTEG_SERVER_URL, OkNetworkSession(), true) // Create the Prebid integration and allow it to start observing the UID2Manager instance. PrebidMobile.initializeSdk(this) { Log.i(TAG, "Prebid: $it") } - prebid = UID2Prebid().apply { + prebid = UID2Prebid( + if (isEnvironmentEUID) EUIDManager.getInstance() else UID2Manager.getInstance(), + ).apply { initialize() } @@ -45,6 +64,7 @@ class DevApplication : Application() { private companion object { const val TAG = "DevApplication" - const val INTEG_SERVER_URL = "https://operator-integ.uidapi.com" + const val UID2_INTEG_SERVER_URL = "https://operator-integ.uidapi.com" + const val EUID_INTEG_SERVER_URL = "https://integ.euid.eu/v2" } } diff --git a/dev-app/src/main/java/com/uid2/dev/MainActivity.kt b/dev-app/src/main/java/com/uid2/dev/MainActivity.kt index 8738e11..ad74ba4 100644 --- a/dev-app/src/main/java/com/uid2/dev/MainActivity.kt +++ b/dev-app/src/main/java/com/uid2/dev/MainActivity.kt @@ -5,23 +5,34 @@ import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.viewModels import androidx.compose.material.MaterialTheme +import com.uid2.EUIDManager import com.uid2.UID2Manager import com.uid2.dev.network.AppUID2Client import com.uid2.dev.ui.MainScreen import com.uid2.dev.ui.MainScreenViewModel import com.uid2.dev.ui.MainScreenViewModelFactory +import com.uid2.dev.utils.getMetadata +import com.uid2.dev.utils.isEnvironmentEUID +import com.uid2.devapp.R class MainActivity : ComponentActivity() { private val viewModel: MainScreenViewModel by viewModels { + val isEUID = getMetadata().isEnvironmentEUID() MainScreenViewModelFactory( AppUID2Client.fromContext(baseContext), - UID2Manager.getInstance(), + if (isEUID) EUIDManager.getInstance() else UID2Manager.getInstance(), + isEUID, ) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + + if (getMetadata().isEnvironmentEUID()) { + setTitle(R.string.app_name_euid) + } + setContent { MaterialTheme { MainScreen(viewModel) diff --git a/dev-app/src/main/java/com/uid2/dev/network/AppUID2Client.kt b/dev-app/src/main/java/com/uid2/dev/network/AppUID2Client.kt index ecb9973..11bb8d5 100644 --- a/dev-app/src/main/java/com/uid2/dev/network/AppUID2Client.kt +++ b/dev-app/src/main/java/com/uid2/dev/network/AppUID2Client.kt @@ -1,12 +1,9 @@ package com.uid2.dev.network import android.content.Context -import android.content.pm.ApplicationInfo -import android.content.pm.PackageManager -import android.os.Build -import android.os.Bundle import android.util.Base64 import com.uid2.data.UID2Identity +import com.uid2.dev.utils.getMetadata import com.uid2.network.DataEnvelope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -191,18 +188,5 @@ class AppUID2Client( it.getString(UID2_API_SECRET_KEY, ""), ) } - - private fun Context.getMetadata(): Bundle = packageManager.getApplicationInfoCompat( - packageName, - PackageManager.GET_META_DATA, - ).metaData - - private fun PackageManager.getApplicationInfoCompat(packageName: String, flags: Int = 0): ApplicationInfo = - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - getApplicationInfo(packageName, PackageManager.ApplicationInfoFlags.of(flags.toLong())) - } else { - @Suppress("DEPRECATION") - getApplicationInfo(packageName, flags) - } } } diff --git a/dev-app/src/main/java/com/uid2/dev/ui/MainScreenViewModel.kt b/dev-app/src/main/java/com/uid2/dev/ui/MainScreenViewModel.kt index cbb6351..4d2f5e6 100644 --- a/dev-app/src/main/java/com/uid2/dev/ui/MainScreenViewModel.kt +++ b/dev-app/src/main/java/com/uid2/dev/ui/MainScreenViewModel.kt @@ -51,11 +51,15 @@ sealed interface MainScreenState : ViewState { class MainScreenViewModel( private val api: AppUID2Client, private val manager: UID2Manager, + isEUID: Boolean, ) : BasicViewModel() { private val _viewState = MutableStateFlow(UserUpdatedState(null, NO_IDENTITY)) override val viewState: StateFlow = _viewState.asStateFlow() + private val subscriptionId: String = if (isEUID) SUBSCRIPTION_ID_EUID else SUBSCRIPTION_ID_UID2 + private val publicKey: String = if (isEUID) PUBLIC_KEY_EUID else PUBLIC_KEY_UID2 + init { // Observe the state of the UID2Manager and translate those into our own ViewState. This will happen when the // Identity is initial set, or refreshed, or reset. @@ -98,8 +102,8 @@ class MainScreenViewModel( // Generate the identity via Client Side Integration (client side token generation). manager.generateIdentity( IdentityRequest.Email(action.address), - SUBSCRIPTION_ID, - PUBLIC_KEY, + subscriptionId, + publicKey, onGenerateResult, ) } else { @@ -120,8 +124,8 @@ class MainScreenViewModel( // Generate the identity via Client Side Integration (client side token generation). manager.generateIdentity( IdentityRequest.Phone(action.number), - SUBSCRIPTION_ID, - PUBLIC_KEY, + subscriptionId, + publicKey, onGenerateResult, ) } else { @@ -149,19 +153,24 @@ class MainScreenViewModel( private companion object { const val TAG = "MainScreenViewModel" - const val SUBSCRIPTION_ID = "toPh8vgJgt" + const val SUBSCRIPTION_ID_UID2 = "toPh8vgJgt" + const val SUBSCRIPTION_ID_EUID = "w6yPQzN4dA" + + @Suppress("ktlint:standard:max-line-length") + const val PUBLIC_KEY_UID2 = "UID2-X-I-MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEKAbPfOz7u25g1fL6riU7p2eeqhjmpALPeYoyjvZmZ1xM2NM8UeOmDZmCIBnKyRZ97pz5bMCjrs38WM22O7LJuw==" @Suppress("ktlint:standard:max-line-length") - const val PUBLIC_KEY = "UID2-X-I-MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEKAbPfOz7u25g1fL6riU7p2eeqhjmpALPeYoyjvZmZ1xM2NM8UeOmDZmCIBnKyRZ97pz5bMCjrs38WM22O7LJuw==" + const val PUBLIC_KEY_EUID = "EUID-X-I-MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEH/k7HYGuWhjhCo8nXgj/ypClo5kek7uRKvzCGwj04Y1eXOWmHDOLAQVCPquZdfVVezIpABNAl9zvsSEC7g+ZGg==" } } class MainScreenViewModelFactory( private val api: AppUID2Client, private val manager: UID2Manager, + private val isEUID: Boolean, ) : ViewModelProvider.Factory { @Suppress("UNCHECKED_CAST") override fun create(modelClass: Class): T { - return MainScreenViewModel(api, manager) as T + return MainScreenViewModel(api, manager, isEUID) as T } } diff --git a/dev-app/src/main/java/com/uid2/dev/utils/BundleEx.kt b/dev-app/src/main/java/com/uid2/dev/utils/BundleEx.kt new file mode 100644 index 0000000..2a68700 --- /dev/null +++ b/dev-app/src/main/java/com/uid2/dev/utils/BundleEx.kt @@ -0,0 +1,7 @@ +package com.uid2.dev.utils + +import android.os.Bundle + +private const val UID2_ENVIRONMENT_EUID = "uid2_environment_euid" + +fun Bundle.isEnvironmentEUID(): Boolean = getBoolean(UID2_ENVIRONMENT_EUID, false) diff --git a/dev-app/src/main/java/com/uid2/dev/utils/ContextEx.kt b/dev-app/src/main/java/com/uid2/dev/utils/ContextEx.kt new file mode 100644 index 0000000..91eef6c --- /dev/null +++ b/dev-app/src/main/java/com/uid2/dev/utils/ContextEx.kt @@ -0,0 +1,10 @@ +package com.uid2.dev.utils + +import android.content.Context +import android.content.pm.PackageManager +import android.os.Bundle + +fun Context.getMetadata(): Bundle = packageManager.getApplicationInfoCompat( + packageName, + PackageManager.GET_META_DATA, +).metaData diff --git a/dev-app/src/main/java/com/uid2/dev/utils/PackageManagerEx.kt b/dev-app/src/main/java/com/uid2/dev/utils/PackageManagerEx.kt new file mode 100644 index 0000000..e4f930c --- /dev/null +++ b/dev-app/src/main/java/com/uid2/dev/utils/PackageManagerEx.kt @@ -0,0 +1,14 @@ +package com.uid2.dev.utils + +import android.content.pm.ApplicationInfo +import android.content.pm.PackageManager +import android.os.Build + +fun PackageManager.getApplicationInfoCompat(packageName: String, flags: Int = 0): ApplicationInfo = + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + @Suppress("WrongConstant") + getApplicationInfo(packageName, PackageManager.ApplicationInfoFlags.of(flags.toLong())) + } else { + @Suppress("DEPRECATION") + getApplicationInfo(packageName, flags) + } diff --git a/dev-app/src/main/res/values/strings.xml b/dev-app/src/main/res/values/strings.xml index 71d8e9b..688f94d 100644 --- a/dev-app/src/main/res/values/strings.xml +++ b/dev-app/src/main/res/values/strings.xml @@ -1,5 +1,6 @@ UID2 SDK Dev App + EUID SDK Dev App Email Phone Number diff --git a/dev-app/src/main/res/xml/network_security_config.xml b/dev-app/src/main/res/xml/network_security_config.xml new file mode 100644 index 0000000..ed4f075 --- /dev/null +++ b/dev-app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/src/main/java/com/uid2/EUIDManager.kt b/sdk/src/main/java/com/uid2/EUIDManager.kt new file mode 100644 index 0000000..10c8559 --- /dev/null +++ b/sdk/src/main/java/com/uid2/EUIDManager.kt @@ -0,0 +1,119 @@ +package com.uid2 + +import android.content.Context +import com.uid2.UID2Manager.Companion.APPLICATION_ID_DEFAULT +import com.uid2.network.DefaultNetworkSession +import com.uid2.network.NetworkSession +import com.uid2.storage.FileStorageManager +import com.uid2.storage.FileStorageManager.Store.EUID +import com.uid2.storage.StorageManager +import com.uid2.utils.InputUtils +import com.uid2.utils.Logger +import com.uid2.utils.TimeUtils +import kotlinx.coroutines.Dispatchers + +public object EUIDManager { + + public sealed interface Environment { + public val serverUrl: String + + /** + * AWS EU West 2 (London). + */ + public data object London : Environment { + override val serverUrl: String = EUID_API_URL_PRODUCTION + } + + /** + * The default Environment, equivalent to [London]. + */ + public data object Production : Environment { + override val serverUrl: String = EUID_API_URL_PRODUCTION + } + + /** + * An Environment with its own API endpoint, such as for integration testing. + */ + public data class Custom( + override val serverUrl: String, + ) : Environment + } + + // The default API server. + internal const val EUID_API_URL_PRODUCTION = "https://prod.euid.eu/v2" + + private var serverUrl: String = EUID_API_URL_PRODUCTION + private var applicationId: String = APPLICATION_ID_DEFAULT + private var networkSession: NetworkSession = DefaultNetworkSession() + private var storageManager: StorageManager? = null + private var isLoggingEnabled: Boolean = false + + private var instance: UID2Manager? = null + + /** + * Initializes the class with the given [Context], along with a [NetworkSession] that will be responsible + * for making any required network calls. + * + * @param context The context to initialise from. This will be used to obtain the package's metadata to extract + * the API URL. + * @param environment The API Environment to use. + * @param networkSession A custom [NetworkSession] which can be used for making any required network calls. + * The default implementation supported by the SDK can be found as [DefaultNetworkSession]. + */ + @JvmStatic + @JvmOverloads + @Throws(InitializationException::class) + public fun init( + context: Context, + environment: Environment = Environment.Production, + networkSession: NetworkSession = DefaultNetworkSession(), + isLoggingEnabled: Boolean = false, + ) { + if (instance != null) { + throw InitializationException() + } + + this.serverUrl = environment.serverUrl + this.applicationId = context.packageName + this.networkSession = networkSession + this.storageManager = FileStorageManager(context.applicationContext, EUID) + this.isLoggingEnabled = isLoggingEnabled + } + + /** + * Returns True if the manager is already initialised, otherwise False. + */ + @JvmStatic + public fun isInitialized(): Boolean = instance != null + + /** + * Gets the current singleton instance of the manager. + * + * @throws InitializationException Thrown if the manager has not yet been initialised. + */ + @JvmStatic + public fun getInstance(): UID2Manager { + if (storageManager == null) { + throw InitializationException() + } + val storage = storageManager ?: throw InitializationException() + val logger = Logger(isLoggingEnabled) + + return instance ?: UID2Manager( + UID2Client( + apiUrl = serverUrl, + session = networkSession, + applicationId = applicationId, + logger = logger, + ), + storage, + TimeUtils, + InputUtils(), + Dispatchers.Default, + true, + logger, + ).apply { + instance = this + } + } +} diff --git a/sdk/src/main/java/com/uid2/UID2Manager.kt b/sdk/src/main/java/com/uid2/UID2Manager.kt index c5b3ed3..c8ac23a 100644 --- a/sdk/src/main/java/com/uid2/UID2Manager.kt +++ b/sdk/src/main/java/com/uid2/UID2Manager.kt @@ -24,6 +24,8 @@ import com.uid2.data.IdentityStatus.REFRESH_EXPIRED import com.uid2.data.UID2Identity import com.uid2.network.DefaultNetworkSession import com.uid2.network.NetworkSession +import com.uid2.storage.FileStorageManager +import com.uid2.storage.FileStorageManager.Store.UID2 import com.uid2.storage.StorageManager import com.uid2.utils.InputUtils import com.uid2.utils.Logger @@ -532,13 +534,67 @@ public class UID2Manager internal constructor( } } + public sealed interface Environment { + public val serverUrl: String + + /** + * AWS US East (Ohio). + */ + public data object Ohio : Environment { + override val serverUrl: String = "https://prod.uidapi.com" + } + + /** + * AWS US West (Oregon). + */ + public data object Oregon : Environment { + override val serverUrl: String = "https://usw.prod.uidapi.com" + } + + /** + * AWS Asia Pacific (Singapore). + */ + public data object Singapore : Environment { + override val serverUrl: String = "https://sg.prod.uidapi.com" + } + + /** + * AWS Asia Pacific (Sydney). + */ + public data object Sydney : Environment { + override val serverUrl: String = "https://au.prod.uidapi.com" + } + + /** + * AWS Asia Pacific (Tokyo). + */ + public data object Tokyo : Environment { + override val serverUrl: String = "https://jp.prod.uidapi.com" + } + + /** + * The default Environment, equivalent to [Ohio]. + */ + public data object Production : Environment { + override val serverUrl: String = UID2_API_URL_PRODUCTION + } + + /** + * An Environment with its own API endpoint, such as for integration testing. + */ + public data class Custom( + override val serverUrl: String, + ) : Environment + } + public companion object { + private const val TAG = "UID2Manager" // The default API server. - private const val UID2_API_URL_DEFAULT = "https://prod.uidapi.com" + internal const val UID2_API_URL_PRODUCTION = "https://prod.uidapi.com" - private const val APPLICATION_ID_DEFAULT = "unknown" + internal const val APPLICATION_ID_DEFAULT = "unknown" private const val PACKAGE_NOT_AVAILABLE = "Identity not available" private const val PACKAGE_AD_TOKEN_NOT_AVAILABLE = "advertising_token is not available or is not valid" @@ -557,7 +613,7 @@ public class UID2Manager internal constructor( // The additional time we will allow to pass before checking the expiration of the Identity. private const val EXPIRATION_CHECK_TOLERANCE_MS = 50 - private var serverUrl: String = UID2_API_URL_DEFAULT + private var serverUrl: String = UID2_API_URL_PRODUCTION private var applicationId: String = APPLICATION_ID_DEFAULT private var networkSession: NetworkSession = DefaultNetworkSession() private var storageManager: StorageManager? = null @@ -565,6 +621,33 @@ public class UID2Manager internal constructor( private var instance: UID2Manager? = null + /** + * Initializes the class with the given [Context], along with a [NetworkSession] that will be responsible + * for making any required network calls. + * + * @param context The context to initialise from. This will be used to obtain the package's metadata to extract + * the API URL. + * @param networkSession A custom [NetworkSession] which can be used for making any required network calls. + * The default implementation supported by the SDK can be found as [DefaultNetworkSession]. + */ + @JvmStatic + @JvmOverloads + @JvmName("initWithEnvironment") + @Throws(InitializationException::class) + @Deprecated( + message = "Initialize with a custom Environment rather than a serverUrl String", + replaceWith = ReplaceWith("initWithEnvironment(context, environment, networkSession, isLoggingEnabled)"), + level = DeprecationLevel.WARNING, + ) + public fun init( + context: Context, + serverUrl: String = UID2_API_URL_PRODUCTION, + networkSession: NetworkSession = DefaultNetworkSession(), + isLoggingEnabled: Boolean = false, + ) { + init(context, Environment.Custom(serverUrl), networkSession, isLoggingEnabled) + } + /** * Initializes the class with the given [Context], along with a [NetworkSession] that will be responsible * for making any required network calls. @@ -579,7 +662,7 @@ public class UID2Manager internal constructor( @Throws(InitializationException::class) public fun init( context: Context, - serverUrl: String = UID2_API_URL_DEFAULT, + environment: Environment = Environment.Production, networkSession: NetworkSession = DefaultNetworkSession(), isLoggingEnabled: Boolean = false, ) { @@ -587,10 +670,10 @@ public class UID2Manager internal constructor( throw InitializationException() } - this.serverUrl = serverUrl + this.serverUrl = environment.serverUrl this.applicationId = context.packageName this.networkSession = networkSession - this.storageManager = StorageManager.getInstance(context.applicationContext) + this.storageManager = FileStorageManager(context.applicationContext, UID2) this.isLoggingEnabled = isLoggingEnabled } diff --git a/sdk/src/main/java/com/uid2/storage/FileStorageManager.kt b/sdk/src/main/java/com/uid2/storage/FileStorageManager.kt index bbd07e7..f1b0246 100644 --- a/sdk/src/main/java/com/uid2/storage/FileStorageManager.kt +++ b/sdk/src/main/java/com/uid2/storage/FileStorageManager.kt @@ -18,6 +18,11 @@ internal class FileStorageManager( private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO, ) : StorageManager { + enum class Store(val filename: String) { + UID2(UID2_FILE_IDENTITY), + EUID(EUID_FILE_IDENTITY), + } + // For storage, we use the parent filesDir which is part of the Application's internal storage. This internal // storage is sandboxed to prevent any other app, or even the user, from accessing it directly. We rely on Android // keeping this file secure. @@ -25,7 +30,7 @@ internal class FileStorageManager( // On Android 10+, this location is also likely encrypted. // // https://developer.android.com/training/data-storage/app-specific#internal-access-files - constructor(context: Context) : this({ File(context.filesDir, FILE_IDENTITY) }) + constructor(context: Context, store: Store) : this({ File(context.filesDir, store.filename) }) // This lazy value *should* only be requested on the ioDispatcher. private val identityFile: File by lazy { identityFileFactory() } @@ -59,7 +64,8 @@ internal class FileStorageManager( } private companion object { - const val FILE_IDENTITY = "uid2_identity.json" + const val UID2_FILE_IDENTITY = "uid2_identity.json" + const val EUID_FILE_IDENTITY = "euid_identity.json" const val KEY_STATUS = "identity_status" // The character set used for both reading and writing to the file. diff --git a/sdk/src/main/java/com/uid2/storage/StorageManager.kt b/sdk/src/main/java/com/uid2/storage/StorageManager.kt index b3c30ff..5ff4869 100644 --- a/sdk/src/main/java/com/uid2/storage/StorageManager.kt +++ b/sdk/src/main/java/com/uid2/storage/StorageManager.kt @@ -1,6 +1,5 @@ package com.uid2.storage -import android.content.Context import com.uid2.data.IdentityStatus import com.uid2.data.UID2Identity @@ -22,15 +21,4 @@ internal interface StorageManager { * Clears any previously stored data. */ suspend fun clear(): Boolean - - companion object { - private var instance: StorageManager? = null - - /** - * Gets the single instance of the FileStorageManager. - */ - fun getInstance(context: Context) = instance ?: FileStorageManager(context).apply { - instance = this - } - } } diff --git a/securesignals-gma-dev-app/src/main/AndroidManifest.xml b/securesignals-gma-dev-app/src/main/AndroidManifest.xml index e686ac6..02047f6 100644 --- a/securesignals-gma-dev-app/src/main/AndroidManifest.xml +++ b/securesignals-gma-dev-app/src/main/AndroidManifest.xml @@ -1,12 +1,15 @@ - + + android:theme="@style/AppTheme" + android:networkSecurityConfig="@xml/network_security_config" + tools:ignore="UnusedAttribute"> + + + + + + + diff --git a/securesignals-gma/src/main/java/com/uid2/securesignals/gma/UID2MediationAdapter.kt b/securesignals-gma/src/main/java/com/uid2/securesignals/gma/UID2MediationAdapter.kt index 8c085b2..2b0763b 100644 --- a/securesignals-gma/src/main/java/com/uid2/securesignals/gma/UID2MediationAdapter.kt +++ b/securesignals-gma/src/main/java/com/uid2/securesignals/gma/UID2MediationAdapter.kt @@ -9,6 +9,7 @@ import com.google.android.gms.ads.mediation.rtb.RtbSignalData import com.google.android.gms.ads.mediation.rtb.SignalCallbacks import com.uid2.UID2 import com.uid2.UID2Manager +import com.uid2.UID2Manager.Environment.Production import com.google.android.gms.ads.mediation.VersionInfo as GmaVersionInfo /** @@ -42,7 +43,7 @@ public class UID2MediationAdapter : RtbAdapter() { ) { // It's possible that the UID2Manager is already initialised. If so, it's a no-op. if (!UID2Manager.isInitialized()) { - UID2Manager.init(context) + UID2Manager.init(context, Production) } // After we've asked to initialize the manager, we should wait until it's complete before reporting success. diff --git a/securesignals-ima-dev-app/src/main/AndroidManifest.xml b/securesignals-ima-dev-app/src/main/AndroidManifest.xml index 27109a8..13d22da 100644 --- a/securesignals-ima-dev-app/src/main/AndroidManifest.xml +++ b/securesignals-ima-dev-app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ - + @@ -9,7 +10,10 @@ android:name=".IMADevApplication" android:label="@string/app_name" android:allowBackup="true" - android:icon="@drawable/ic_launcher"> + android:icon="@drawable/ic_launcher" + android:networkSecurityConfig="@xml/network_security_config" + tools:ignore="UnusedAttribute"> + + + + + + + + diff --git a/securesignals-ima/src/main/java/com/uid2/securesignals/ima/UID2SecureSignalsAdapter.kt b/securesignals-ima/src/main/java/com/uid2/securesignals/ima/UID2SecureSignalsAdapter.kt index dcdc8c2..76e739f 100644 --- a/securesignals-ima/src/main/java/com/uid2/securesignals/ima/UID2SecureSignalsAdapter.kt +++ b/securesignals-ima/src/main/java/com/uid2/securesignals/ima/UID2SecureSignalsAdapter.kt @@ -7,6 +7,7 @@ import com.google.ads.interactivemedia.v3.api.signals.SecureSignalsCollectSignal import com.google.ads.interactivemedia.v3.api.signals.SecureSignalsInitializeCallback import com.uid2.UID2 import com.uid2.UID2Manager +import com.uid2.UID2Manager.Environment.Production /** * A custom exception type that is used to report failures from the UID2SecureSignalsAdapter when an error has occurred. @@ -38,7 +39,7 @@ public class UID2SecureSignalsAdapter : SecureSignalsAdapter { public override fun initialize(context: Context, callback: SecureSignalsInitializeCallback) { // It's possible that the UID2Manager is already initialised. If so, it's a no-op. if (!UID2Manager.isInitialized()) { - UID2Manager.init(context) + UID2Manager.init(context, environment = Production) } // After we've asked to initialize the manager, we should wait until it's complete before reporting success.