diff --git a/sample/kotlin/build.gradle.kts b/sample/kotlin/build.gradle.kts
index 959a439e2e..7e0ad1248a 100644
--- a/sample/kotlin/build.gradle.kts
+++ b/sample/kotlin/build.gradle.kts
@@ -66,14 +66,14 @@ android {
unitTests.isReturnDefaultValues = true
}
- flavorDimensions += listOf("version")
+ flavorDimensions += listOf("site")
productFlavors {
val regions = arrayOf("us1", "us3", "us5", "us1_fed", "eu1", "ap1", "staging")
regions.forEachIndexed { index, region ->
register(region) {
isDefault = index == 0
- dimension = "version"
+ dimension = "site"
configureFlavorForSampleApp(this, project.rootDir)
}
}
@@ -111,16 +111,16 @@ android {
dependencies {
- api(project(":dd-sdk-android"))
- api(project(":dd-sdk-android-ktx"))
- api(project(":dd-sdk-android-ndk"))
- api(project(":dd-sdk-android-rx"))
- api(project(":dd-sdk-android-timber"))
- api(project(":dd-sdk-android-coil"))
- api(project(":dd-sdk-android-glide"))
- api(project(":dd-sdk-android-fresco"))
- api(project(":dd-sdk-android-sqldelight"))
- api(project(":dd-sdk-android-compose"))
+ implementation(project(":dd-sdk-android"))
+ implementation(project(":dd-sdk-android-ktx"))
+ implementation(project(":dd-sdk-android-ndk"))
+ implementation(project(":dd-sdk-android-rx"))
+ implementation(project(":dd-sdk-android-timber"))
+ implementation(project(":dd-sdk-android-coil"))
+ implementation(project(":dd-sdk-android-glide"))
+ implementation(project(":dd-sdk-android-fresco"))
+ implementation(project(":dd-sdk-android-sqldelight"))
+ implementation(project(":dd-sdk-android-compose"))
implementation(libs.kotlin)
diff --git a/sample/wear/.gitignore b/sample/wear/.gitignore
new file mode 100644
index 0000000000..42afabfd2a
--- /dev/null
+++ b/sample/wear/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/sample/wear/build.gradle.kts b/sample/wear/build.gradle.kts
new file mode 100644
index 0000000000..7ae31db743
--- /dev/null
+++ b/sample/wear/build.gradle.kts
@@ -0,0 +1,64 @@
+/*
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
+ * Copyright 2016-Present Datadog, Inc.
+ */
+
+import com.datadog.gradle.config.AndroidConfig
+import com.datadog.gradle.config.configureFlavorForSampleApp
+
+plugins {
+ id("com.android.application")
+ id("org.jetbrains.kotlin.android")
+}
+
+android {
+ compileSdk = AndroidConfig.TARGET_SDK
+ buildToolsVersion = AndroidConfig.BUILD_TOOLS_VERSION
+
+ defaultConfig {
+ applicationId = "com.datadog.android.wear.sample"
+ minSdk = AndroidConfig.MIN_SDK_FOR_COMPOSE
+ targetSdk = AndroidConfig.TARGET_SDK
+ versionCode = AndroidConfig.VERSION.code
+ versionName = AndroidConfig.VERSION.name
+ }
+
+ namespace = "com.datadog.android.wear.sample"
+
+ flavorDimensions += listOf("site")
+ productFlavors {
+ val regions = arrayOf("us1", "us3", "us5", "us1_fed", "eu1", "ap1", "staging")
+
+ regions.forEachIndexed { index, region ->
+ register(region) {
+ isDefault = index == 0
+ dimension = "site"
+ configureFlavorForSampleApp(this, project.rootDir)
+ }
+ }
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ buildFeatures {
+ viewBinding = true
+ }
+}
+
+dependencies {
+
+ implementation(project(":dd-sdk-android"))
+ implementation("androidx.core:core-ktx:1.7.0")
+ implementation("com.google.android.gms:play-services-wearable:17.1.0")
+ implementation("androidx.legacy:legacy-support-v4:1.0.0")
+ implementation("androidx.recyclerview:recyclerview:1.3.0")
+ implementation("androidx.wear:wear:1.2.0")
+}
diff --git a/sample/wear/proguard-rules.pro b/sample/wear/proguard-rules.pro
new file mode 100644
index 0000000000..481bb43481
--- /dev/null
+++ b/sample/wear/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/sample/wear/src/main/AndroidManifest.xml b/sample/wear/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..ed55a9d6d9
--- /dev/null
+++ b/sample/wear/src/main/AndroidManifest.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/wear/src/main/java/com/datadog/android/wear/sample/MainActivity.kt b/sample/wear/src/main/java/com/datadog/android/wear/sample/MainActivity.kt
new file mode 100644
index 0000000000..5b462076aa
--- /dev/null
+++ b/sample/wear/src/main/java/com/datadog/android/wear/sample/MainActivity.kt
@@ -0,0 +1,24 @@
+/*
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
+ * Copyright 2016-Present Datadog, Inc.
+ */
+
+package com.datadog.android.wear.sample
+
+import android.app.Activity
+import android.os.Bundle
+import com.datadog.android.wear.sample.databinding.ActivityMainBinding
+
+@Suppress("UndocumentedPublicProperty", "UndocumentedPublicClass")
+class MainActivity : Activity() {
+
+ private lateinit var binding: ActivityMainBinding
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ binding = ActivityMainBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+ }
+}
diff --git a/sample/wear/src/main/java/com/datadog/android/wear/sample/WearApplication.kt b/sample/wear/src/main/java/com/datadog/android/wear/sample/WearApplication.kt
new file mode 100644
index 0000000000..0bea699e1b
--- /dev/null
+++ b/sample/wear/src/main/java/com/datadog/android/wear/sample/WearApplication.kt
@@ -0,0 +1,96 @@
+/*
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
+ * Copyright 2016-Present Datadog, Inc.
+ */
+
+package com.datadog.android.wear.sample
+
+import android.app.Application
+import android.util.Log
+import com.datadog.android.Datadog
+import com.datadog.android.DatadogSite
+import com.datadog.android.core.configuration.Configuration
+import com.datadog.android.core.configuration.Credentials
+import com.datadog.android.privacy.TrackingConsent
+import com.datadog.android.rum.GlobalRum
+import com.datadog.android.rum.RumMonitor
+import com.datadog.android.rum.tracking.ActivityViewTrackingStrategy
+import com.datadog.android.tracing.AndroidTracer
+import io.opentracing.util.GlobalTracer
+
+/**
+ * The main [Application] for the sample WearOs project.
+ */
+class WearApplication : Application() {
+
+ override fun onCreate() {
+ super.onCreate()
+ initializeDatadog()
+ }
+
+ private fun initializeDatadog() {
+ Datadog.initialize(
+ this,
+ createDatadogCredentials(),
+ createDatadogConfiguration(),
+ TrackingConsent.GRANTED
+ )
+ Datadog.setVerbosity(Log.VERBOSE)
+ Datadog.enableRumDebugging(true)
+ Datadog.setUserInfo(
+ "wear 42",
+ null,
+ null
+ )
+
+ GlobalTracer.registerIfAbsent(
+ AndroidTracer.Builder()
+ .setServiceName(BuildConfig.APPLICATION_ID)
+ .build()
+ )
+ GlobalRum.registerIfAbsent(RumMonitor.Builder().build())
+ }
+
+ private fun createDatadogCredentials(): Credentials {
+ return Credentials(
+ clientToken = BuildConfig.DD_CLIENT_TOKEN,
+ envName = BuildConfig.BUILD_TYPE,
+ variant = BuildConfig.FLAVOR,
+ rumApplicationId = BuildConfig.DD_RUM_APPLICATION_ID
+ )
+ }
+
+ @Suppress("MagicNumber")
+ private fun createDatadogConfiguration(): Configuration {
+ val configBuilder = Configuration.Builder(
+ logsEnabled = true,
+ tracesEnabled = true,
+ crashReportsEnabled = true,
+ rumEnabled = true
+ )
+ .sampleTelemetry(100f)
+ .useViewTrackingStrategy(ActivityViewTrackingStrategy(true))
+ .trackInteractions()
+ .trackLongTasks(250L)
+
+ try {
+ configBuilder.useSite(DatadogSite.valueOf(BuildConfig.DD_SITE_NAME))
+ } catch (e: IllegalArgumentException) {
+ Log.e("WearApplication", "Error setting site to ${BuildConfig.DD_SITE_NAME}")
+ }
+
+ if (BuildConfig.DD_OVERRIDE_LOGS_URL.isNotBlank()) {
+ configBuilder.useCustomLogsEndpoint(BuildConfig.DD_OVERRIDE_LOGS_URL)
+ configBuilder.useCustomCrashReportsEndpoint(BuildConfig.DD_OVERRIDE_LOGS_URL)
+ }
+ if (BuildConfig.DD_OVERRIDE_TRACES_URL.isNotBlank()) {
+ configBuilder.useCustomTracesEndpoint(BuildConfig.DD_OVERRIDE_TRACES_URL)
+ }
+ if (BuildConfig.DD_OVERRIDE_RUM_URL.isNotBlank()) {
+ configBuilder.useCustomRumEndpoint(BuildConfig.DD_OVERRIDE_RUM_URL)
+ }
+
+ return configBuilder.build()
+ }
+}
diff --git a/sample/wear/src/main/res/layout/activity_main.xml b/sample/wear/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000000..9a0c0bb1cf
--- /dev/null
+++ b/sample/wear/src/main/res/layout/activity_main.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/wear/src/main/res/mipmap-hdpi/ic_launcher.webp b/sample/wear/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 0000000000..c209e78ecd
Binary files /dev/null and b/sample/wear/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/sample/wear/src/main/res/mipmap-mdpi/ic_launcher.webp b/sample/wear/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 0000000000..4f0f1d64e5
Binary files /dev/null and b/sample/wear/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/sample/wear/src/main/res/mipmap-xhdpi/ic_launcher.webp b/sample/wear/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 0000000000..948a3070fe
Binary files /dev/null and b/sample/wear/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/sample/wear/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/sample/wear/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 0000000000..28d4b77f9f
Binary files /dev/null and b/sample/wear/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/sample/wear/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/sample/wear/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 0000000000..aa7d6427e6
Binary files /dev/null and b/sample/wear/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/sample/wear/src/main/res/values-round/strings.xml b/sample/wear/src/main/res/values-round/strings.xml
new file mode 100644
index 0000000000..d74c66c621
--- /dev/null
+++ b/sample/wear/src/main/res/values-round/strings.xml
@@ -0,0 +1,3 @@
+
+ Hello Round World!
+
\ No newline at end of file
diff --git a/sample/wear/src/main/res/values/dimens.xml b/sample/wear/src/main/res/values/dimens.xml
new file mode 100644
index 0000000000..1a7ba4a1a6
--- /dev/null
+++ b/sample/wear/src/main/res/values/dimens.xml
@@ -0,0 +1,15 @@
+
+
+
+ 0dp
+
+
+ 5dp
+
\ No newline at end of file
diff --git a/sample/wear/src/main/res/values/strings.xml b/sample/wear/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..e2993c47a4
--- /dev/null
+++ b/sample/wear/src/main/res/values/strings.xml
@@ -0,0 +1,14 @@
+
+
+
+ Wear
+
+ Hello Square World!
+
\ No newline at end of file
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 1de7cf5834..689f82b77e 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -24,6 +24,7 @@ include(":instrumented:nightly-tests")
include(":library:dd-sdk-android-session-replay")
include(":sample:kotlin")
+include(":sample:wear")
include(":tools:detekt")
include(":tools:unit")