Skip to content

Instantly share code, notes, and snippets.

@LethalMaus
Created January 15, 2026 22:07
Show Gist options
  • Select an option

  • Save LethalMaus/bed6b48c9826191428a6bcca42c7800c to your computer and use it in GitHub Desktop.

Select an option

Save LethalMaus/bed6b48c9826191428a6bcca42c7800c to your computer and use it in GitHub Desktop.
syncUserProfile.kt
fun syncUserProfile(profile: UserProfile) {
scope.launch {
val request = PutDataMapRequest.create(WearPaths.USER_PROFILE).apply {
dataMap.putString(WearKeys.USERNAME, profile.username)
}.asPutDataRequest().setUrgent()
runCatching { dataClient.putDataItem(request).await() }
.onSuccess { _userProfile.value = profile }
.onFailure { throwable ->
Log.e(TAG, "Failed to sync user profile", throwable)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment