Skip to content

Commit

Permalink
Merge branch 'AppMetrica'
Browse files Browse the repository at this point in the history
* AppMetrica:
  Updated snippet for Android
  • Loading branch information
Lutik-sun committed Nov 5, 2024
2 parents e89a0c0 + 26295a9 commit c593bc9
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions versioned_docs/version-3.0/appmetrica.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,30 @@ YMMYandexMetrica.requestAppMetricaDeviceID(withCompletionQueue: .main) { deviceI
</TabItem>
<TabItem value="kotlin" label="Android (Kotlin)" default>
```kotlin
val params = AdaptyProfileParameters.Builder()
.withAppmetricaDeviceId(appmetricaDeviceId)
.withAppmetricaProfileId(appmetricaProfileId)
.build()
Adapty.updateProfile(params) { error ->
if (error != null) {
// handle the error
val startupParamsCallback = object: StartupParamsCallback {
override fun onReceive(result: StartupParamsCallback.Result?) {
val deviceId = result?.deviceId ?: return

val params = AdaptyProfileParameters.Builder()
.withAppmetricaDeviceId(deviceId)
.withAppmetricaProfileId("YOUR_ADAPTY_CUSTOMER_USER_ID")
.build()
Adapty.updateProfile(params) { error ->
if (error != null) {
// handle the error
}
}
}

override fun onRequestError(
reason: StartupParamsCallback.Reason,
result: StartupParamsCallback.Result?
) {
//handle error
}
}

AppMetrica.requestStartupParams(context, startupParamsCallback, listOf(StartupParamsCallback.APPMETRICA_DEVICE_ID))
```
</TabItem>
<TabItem value="Flutter" label="Flutter (Dart)" default>
Expand Down

0 comments on commit c593bc9

Please sign in to comment.