diff --git a/dev-app/src/main/AndroidManifest.xml b/dev-app/src/main/AndroidManifest.xml
index 84e0046..068e6ca 100644
--- a/dev-app/src/main/AndroidManifest.xml
+++ b/dev-app/src/main/AndroidManifest.xml
@@ -14,7 +14,6 @@
tools:targetApi="31">
-
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 fa42248..0f25c45 100644
--- a/dev-app/src/main/java/com/uid2/dev/DevApplication.kt
+++ b/dev-app/src/main/java/com/uid2/dev/DevApplication.kt
@@ -10,10 +10,10 @@ class DevApplication : Application() {
// 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, isLoggingEnabled = true)
+ UID2Manager.init(context = this, serverUrl = INTEG_SERVER_URL, isLoggingEnabled = true)
// Alternatively, we could initialise the UID2Manager with our own custom NetworkSession...
- // UID2Manager.init(this.applicationContext, OkNetworkSession(), true)
+ // UID2Manager.init(this, INTEG_SERVER_URL, OkNetworkSession(), true)
// For the development app, we will enable a strict thread policy to ensure we have suitable visibility of any
// issues within the SDK.
@@ -30,4 +30,8 @@ class DevApplication : Application() {
}.build(),
)
}
+
+ private companion object {
+ const val INTEG_SERVER_URL = "https://operator-integ.uidapi.com"
+ }
}
diff --git a/sdk/src/main/java/com/uid2/UID2Manager.kt b/sdk/src/main/java/com/uid2/UID2Manager.kt
index 2bb2592..1f30f4a 100644
--- a/sdk/src/main/java/com/uid2/UID2Manager.kt
+++ b/sdk/src/main/java/com/uid2/UID2Manager.kt
@@ -19,7 +19,6 @@ import com.uid2.data.IdentityStatus.OPT_OUT
import com.uid2.data.IdentityStatus.REFRESHED
import com.uid2.data.IdentityStatus.REFRESH_EXPIRED
import com.uid2.data.UID2Identity
-import com.uid2.extensions.getMetadata
import com.uid2.network.DefaultNetworkSession
import com.uid2.network.NetworkSession
import com.uid2.storage.StorageManager
@@ -446,7 +445,6 @@ public class UID2Manager internal constructor(
private const val TAG = "UID2Manager"
// The default API server.
- private const val UID2_API_URL_KEY = "uid2_api_url"
private const val UID2_API_URL_DEFAULT = "https://prod.uidapi.com"
private const val PACKAGE_NOT_AVAILABLE = "Identity not available"
@@ -466,7 +464,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 api: String = UID2_API_URL_DEFAULT
+ private var serverUrl: String = UID2_API_URL_DEFAULT
private var networkSession: NetworkSession = DefaultNetworkSession()
private var storageManager: StorageManager? = null
private var isLoggingEnabled: Boolean = false
@@ -487,6 +485,7 @@ public class UID2Manager internal constructor(
@Throws(InitializationException::class)
public fun init(
context: Context,
+ serverUrl: String = UID2_API_URL_DEFAULT,
networkSession: NetworkSession = DefaultNetworkSession(),
isLoggingEnabled: Boolean = false,
) {
@@ -494,9 +493,7 @@ public class UID2Manager internal constructor(
throw InitializationException()
}
- val metadata = context.getMetadata()
-
- this.api = metadata?.getString(UID2_API_URL_KEY, UID2_API_URL_DEFAULT) ?: UID2_API_URL_DEFAULT
+ this.serverUrl = serverUrl
this.networkSession = networkSession
this.storageManager = StorageManager.getInstance(context.applicationContext)
this.isLoggingEnabled = isLoggingEnabled
@@ -520,7 +517,7 @@ public class UID2Manager internal constructor(
return instance ?: UID2Manager(
UID2Client(
- api,
+ serverUrl,
networkSession,
logger,
),
diff --git a/sdk/src/main/java/com/uid2/extensions/ContextEx.kt b/sdk/src/main/java/com/uid2/extensions/ContextEx.kt
deleted file mode 100644
index 8414c0e..0000000
--- a/sdk/src/main/java/com/uid2/extensions/ContextEx.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.uid2.extensions
-
-import android.content.Context
-import android.content.pm.ApplicationInfo
-import android.content.pm.PackageManager
-import android.os.Build
-import android.os.Bundle
-
-/**
- * Helper method to extract the MetaData Bundle associated with the given Context.
- */
-internal 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)
- }